Skip to content

Commit 7aa0eb6

Browse files
authored
Merge pull request #11 from factorial-io/feature!/append-min-max-width
Feature!/append min/max width
2 parents 7f6824c + 47951f7 commit 7aa0eb6

File tree

2 files changed

+27
-27
lines changed

2 files changed

+27
-27
lines changed

README.md

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -98,48 +98,48 @@ theme_name.lg:
9898
```css
9999
/* Generated CSS file */
100100
@custom-media --Themename-small-mediaQuery (only screen and (max-width: 47.9375rem));
101-
@custom-media --Themename-small-resolution (2x);
102-
@custom-media --Themename-small-maxWidth (47.9375rem);
101+
@custom-media --Themename-small-resolution (resolution: 2x);
102+
@custom-media --Themename-small-maxWidth (max-width: 47.9375rem);
103103
@custom-media --Themename-medium-mediaQuery (only screen and (min-width: 48rem) and (max-width: 63.9375rem));
104-
@custom-media --Themename-medium-resolution (2x);
105-
@custom-media --Themename-medium-minWidth (48rem);
106-
@custom-media --Themename-medium-maxWidth (63.9375rem);
104+
@custom-media --Themename-medium-resolution (resolution: 2x);
105+
@custom-media --Themename-medium-minWidth (min-width: 48rem);
106+
@custom-media --Themename-medium-maxWidth (max-width: 63.9375rem);
107107
@custom-media --Themename-large-mediaQuery (only screen and (min-width: 64rem) and (max-width: 89.9375rem));
108-
@custom-media --Themename-large-resolution (2x);
109-
@custom-media --Themename-large-minWidth (64rem);
110-
@custom-media --Themename-large-maxWidth (89.9375rem);
108+
@custom-media --Themename-large-resolution (resolution: 2x);
109+
@custom-media --Themename-large-minWidth (min-width: 64rem);
110+
@custom-media --Themename-large-maxWidth (max-width: 89.9375rem);
111111

112112
:root {
113113
--ThemeName-small-mediaQuery: "only screen and (max-width: 47.9375rem)";
114-
--ThemeName-small-resolution: "2x";
115-
--ThemeName-small-maxWidth: "47.9375rem";
114+
--ThemeName-small-resolution: "resolution: 2x";
115+
--ThemeName-small-maxWidth: "max-width: 47.9375rem";
116116
--ThemeName-medium-mediaQuery: "only screen and (min-width: 48rem) and (max-width: 63.9375rem)";
117-
--ThemeName-medium-resolution: "2x";
118-
--ThemeName-medium-minWidth: "48rem";
119-
--ThemeName-medium-maxWidth: "63.9375rem";
117+
--ThemeName-medium-resolution: "resolution: 2x";
118+
--ThemeName-medium-minWidth: "min-width: 48rem";
119+
--ThemeName-medium-maxWidth: "max-width: 63.9375rem";
120120
--ThemeName-Group-large-mediaQuery: "only screen and (min-width: 64rem) and (max-width: 89.9375rem)";
121-
--ThemeName-Group-large-resolution: "2x";
122-
--ThemeName-Group-large-minWidth: "64rem";
123-
--ThemeName-Group-large-maxWidth: "89.9375rem";
121+
--ThemeName-Group-large-resolution: "resolution: 2x";
122+
--ThemeName-Group-large-minWidth: "min-width: 64rem";
123+
--ThemeName-Group-large-maxWidth: "max-width: 89.9375rem";
124124
}
125125
```
126126

127127
```js
128128
// Generated JS file
129129
const BREAKPOINTS = {
130130
"ThemeName-small-mediaQuery": "only screen and (max-width: 47.9375rem)",
131-
"ThemeName-small-resolution": "2x",
132-
"ThemeName-small-maxWidth": "47.9375rem",
131+
"ThemeName-small-resolution": "resolution: 2x",
132+
"ThemeName-small-maxWidth": "max-width: 47.9375rem",
133133
"ThemeName-medium-mediaQuery":
134134
"only screen and (min-width: 48rem) and (max-width: 63.9375rem)",
135-
"ThemeName-medium-resolution": "2x",
136-
"ThemeName-medium-minWidth": "48rem",
137-
"ThemeName-medium-maxWidth": "63.9375rem",
135+
"ThemeName-medium-resolution": "resolution: 2x",
136+
"ThemeName-medium-minWidth": "min-width: 48rem",
137+
"ThemeName-medium-maxWidth": "max-width: 63.9375rem",
138138
"ThemeName-Group-large-mediaQuery":
139139
"only screen and (min-width: 64rem) and (max-width: 89.9375rem)",
140-
"ThemeName-Group-large-resolution": "2x",
141-
"ThemeName-Group-large-minWidth": "64rem",
142-
"ThemeName-Group-large-maxWidth": "89.9375rem",
140+
"ThemeName-Group-large-resolution": "resolution: 2x",
141+
"ThemeName-Group-large-minWidth": "min-width: 64rem",
142+
"ThemeName-Group-large-maxWidth": "max-width: 89.9375rem",
143143
};
144144
export default BREAKPOINTS;
145145
```

lib/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ module.exports = class Breakpoints {
339339
if (!Number.isFinite(width[2]) && !UNITS.length.includes(width[4])) {
340340
throw new RangeError(MESSAGES.widthRangeError(option));
341341
}
342-
return width[2] + width[4];
342+
return `min-width: ${width[2]}${width[4]}`;
343343
}
344344

345345
/**
@@ -360,7 +360,7 @@ module.exports = class Breakpoints {
360360
if (!Number.isFinite(width[2]) && !UNITS.length.includes(width[4])) {
361361
throw new RangeError(MESSAGES.widthRangeError(option));
362362
}
363-
return width[2] + width[4];
363+
return `max-width: ${width[2]}${width[4]}`;
364364
}
365365

366366
/**
@@ -389,7 +389,7 @@ module.exports = class Breakpoints {
389389
) {
390390
throw new RangeError(MESSAGES.resolutionRangeError(option));
391391
}
392-
return resolution[1] + resolution[2];
392+
return `resolution: ${resolution[1]}${resolution[2]}`;
393393
}
394394

395395
/**

0 commit comments

Comments
 (0)