@financial-times/o-grid
Advanced tools
Comparing version 6.0.0-beta.0 to 6.0.0
36
main.js
@@ -84,7 +84,6 @@ /* eslint-disable no-console */ | ||
const layouts = gridLayouts.layouts; | ||
const breakpoints = new Map([ | ||
...Object.keys(layouts).map(key => [key, layouts[key]]), | ||
const breakpoints = [ | ||
...Object.entries(layouts), | ||
['default', '240px'] | ||
]); | ||
const decr1 = val => `${Number(val.replace('px', '') - 1)}px`; | ||
].sort((a, b) => parseFloat(a[1]) - parseFloat(b[1])); | ||
@@ -109,22 +108,13 @@ const setupQuery = (query, size) => { | ||
// Generate media queries for each | ||
breakpoints.forEach((width, size) => { | ||
switch(size) { | ||
case 'S': | ||
setupQuery(`(min-width: ${ width }) and (max-width: ${ decr1(breakpoints.get('M')) })`, size); | ||
break; | ||
case 'M': | ||
setupQuery(`(min-width: ${ width }) and (max-width: ${ decr1(breakpoints.get('L')) })`, size); | ||
break; | ||
case 'L': | ||
setupQuery(`(min-width: ${ width }) and (max-width: ${ decr1(breakpoints.get('XL')) })`, size); | ||
break; | ||
case 'XL': | ||
setupQuery(`(min-width: ${ width })`, size); | ||
break; | ||
case 'default': | ||
default: | ||
setupQuery(`(max-width: ${ decr1(breakpoints.get('S')) })`, size); | ||
break; | ||
const decr1 = val => `${Number(val.replace('px', '') - 1)}px`; | ||
for (let index = 0; index < breakpoints.length; index++) { | ||
const [layoutName, layoutWidth] = breakpoints[index]; | ||
const isLast = index === breakpoints.length - 1; | ||
if (isLast) { | ||
setupQuery(`(min-width: ${layoutWidth})`, layoutName); | ||
continue; | ||
} | ||
}); | ||
const [,nextLayoutWidth] = breakpoints[index + 1]; | ||
setupQuery(`(min-width: ${layoutWidth}) and (max-width: ${decr1(nextLayoutWidth)})`, layoutName); | ||
} | ||
} else { | ||
@@ -131,0 +121,0 @@ console.error('Could not enable grid layout change events. Include o-grid css. See the README (https://registry.origami.ft.com/components/o-grid/readme) for more details.'); |
## Migration Guide | ||
### Migrating from v5 to v6 | ||
V6 has dropped support for use through Bower. | ||
If you were already using npm, no changes should be required. | ||
If you have been using Bower or the Origami Build Service, follow [the migration guide on the Origami website](https://origami.ft.com/docs/tutorials/bower-to-npm/). | ||
### Migrating from v4 to v5 | ||
@@ -4,0 +12,0 @@ |
@@ -45,18 +45,4 @@ { | ||
"description": "Fixed grid at 610px across all browsers and devices. Should always be fixed at the large layout" | ||
}, | ||
{ | ||
"name": "test", | ||
"title": "Test Grid", | ||
"template": "demos/src/test.mustache", | ||
"js": "demos/src/js/style-switcher.js", | ||
"sass": "demos/src/scss/default.scss", | ||
"hidden": true, | ||
"description": "test demo", | ||
"data": "demos/src/configurations.json", | ||
"documentClasses": "test", | ||
"dependencies": [ | ||
"@financial-times/o-buttons@7.0.0-0" | ||
] | ||
} | ||
] | ||
} |
{ | ||
"name": "@financial-times/o-grid", | ||
"version": "6.0.0-beta.0", | ||
"version": "6.0.0", | ||
"description": "A 12 column responsive, flexbox-based grid system for laying out documents, templates and components.", | ||
@@ -21,9 +21,9 @@ "keywords": [ | ||
"start": "npx serve ./demos/local", | ||
"build": "npm_config_yes=true npx \"origami-build-tools@prerelease\" install && npm_config_yes=true npx \"origami-build-tools@prerelease\" demo" | ||
"build": "npm_config_yes=true npx \"origami-build-tools@v11\" install && npm_config_yes=true npx \"origami-build-tools@v11\" demo" | ||
}, | ||
"devDependencies": { | ||
"eslint": "^7.24.0", | ||
"eslint": "^7.28.0", | ||
"eslint-config-origami-component": "^2.1.1", | ||
"remark-preset-lint-origami-component": "^2.0.0-beta.2", | ||
"stylelint": "^13.12.0", | ||
"remark-preset-lint-origami-component": "^2.0.0", | ||
"stylelint": "^13.13.1", | ||
"stylelint-config-origami-component": "^1.0.4" | ||
@@ -30,0 +30,0 @@ }, |
@@ -703,4 +703,5 @@ # o-grid | ||
:---: | :---: | :---: | :---: | ||
✨ active | 5 | N/A | [migrate to v5](MIGRATION.md#migrating-from-v4-to-v5) | | ||
⚠ maintained | 4 | 4.5 | [migrate to v4](MIGRATION.md#migrating-from-v3-to-v4) | | ||
✨ active | 6 | N/A | [migrate to v5](MIGRATION.md#migrating-from-v5-to-v6) | | ||
⚠ maintained | 5 | N/A | [migrate to v5](MIGRATION.md#migrating-from-v4-to-v5) | | ||
╳ deprecated | 4 | 4.5 | [migrate to v4](MIGRATION.md#migrating-from-v3-to-v4) | | ||
╳ deprecated | 3 | 3.2 | - | | ||
@@ -707,0 +708,0 @@ ╳ deprecated | 2 | 2.4 | - | |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
1
721
455091
25
476