Skip to content

Commit 038b158

Browse files
committed
Add max-w-screen-{breakpoint} utilities
1 parent 6312c76 commit 038b158

File tree

4 files changed

+187
-13
lines changed

4 files changed

+187
-13
lines changed

__tests__/fixtures/tailwind-output-important.css

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5057,6 +5057,22 @@ video {
50575057
max-width: 100% !important;
50585058
}
50595059

5060+
.max-w-screen-sm {
5061+
max-width: 640px !important;
5062+
}
5063+
5064+
.max-w-screen-md {
5065+
max-width: 768px !important;
5066+
}
5067+
5068+
.max-w-screen-lg {
5069+
max-width: 1024px !important;
5070+
}
5071+
5072+
.max-w-screen-xl {
5073+
max-width: 1280px !important;
5074+
}
5075+
50605076
.min-h-0 {
50615077
min-height: 0 !important;
50625078
}
@@ -14331,6 +14347,22 @@ video {
1433114347
max-width: 100% !important;
1433214348
}
1433314349

14350+
.sm\:max-w-screen-sm {
14351+
max-width: 640px !important;
14352+
}
14353+
14354+
.sm\:max-w-screen-md {
14355+
max-width: 768px !important;
14356+
}
14357+
14358+
.sm\:max-w-screen-lg {
14359+
max-width: 1024px !important;
14360+
}
14361+
14362+
.sm\:max-w-screen-xl {
14363+
max-width: 1280px !important;
14364+
}
14365+
1433414366
.sm\:min-h-0 {
1433514367
min-height: 0 !important;
1433614368
}
@@ -23606,6 +23638,22 @@ video {
2360623638
max-width: 100% !important;
2360723639
}
2360823640

23641+
.md\:max-w-screen-sm {
23642+
max-width: 640px !important;
23643+
}
23644+
23645+
.md\:max-w-screen-md {
23646+
max-width: 768px !important;
23647+
}
23648+
23649+
.md\:max-w-screen-lg {
23650+
max-width: 1024px !important;
23651+
}
23652+
23653+
.md\:max-w-screen-xl {
23654+
max-width: 1280px !important;
23655+
}
23656+
2360923657
.md\:min-h-0 {
2361023658
min-height: 0 !important;
2361123659
}
@@ -32881,6 +32929,22 @@ video {
3288132929
max-width: 100% !important;
3288232930
}
3288332931

32932+
.lg\:max-w-screen-sm {
32933+
max-width: 640px !important;
32934+
}
32935+
32936+
.lg\:max-w-screen-md {
32937+
max-width: 768px !important;
32938+
}
32939+
32940+
.lg\:max-w-screen-lg {
32941+
max-width: 1024px !important;
32942+
}
32943+
32944+
.lg\:max-w-screen-xl {
32945+
max-width: 1280px !important;
32946+
}
32947+
3288432948
.lg\:min-h-0 {
3288532949
min-height: 0 !important;
3288632950
}
@@ -42156,6 +42220,22 @@ video {
4215642220
max-width: 100% !important;
4215742221
}
4215842222

42223+
.xl\:max-w-screen-sm {
42224+
max-width: 640px !important;
42225+
}
42226+
42227+
.xl\:max-w-screen-md {
42228+
max-width: 768px !important;
42229+
}
42230+
42231+
.xl\:max-w-screen-lg {
42232+
max-width: 1024px !important;
42233+
}
42234+
42235+
.xl\:max-w-screen-xl {
42236+
max-width: 1280px !important;
42237+
}
42238+
4215942239
.xl\:min-h-0 {
4216042240
min-height: 0 !important;
4216142241
}

__tests__/fixtures/tailwind-output.css

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5057,6 +5057,22 @@ video {
50575057
max-width: 100%;
50585058
}
50595059

5060+
.max-w-screen-sm {
5061+
max-width: 640px;
5062+
}
5063+
5064+
.max-w-screen-md {
5065+
max-width: 768px;
5066+
}
5067+
5068+
.max-w-screen-lg {
5069+
max-width: 1024px;
5070+
}
5071+
5072+
.max-w-screen-xl {
5073+
max-width: 1280px;
5074+
}
5075+
50605076
.min-h-0 {
50615077
min-height: 0;
50625078
}
@@ -14331,6 +14347,22 @@ video {
1433114347
max-width: 100%;
1433214348
}
1433314349

14350+
.sm\:max-w-screen-sm {
14351+
max-width: 640px;
14352+
}
14353+
14354+
.sm\:max-w-screen-md {
14355+
max-width: 768px;
14356+
}
14357+
14358+
.sm\:max-w-screen-lg {
14359+
max-width: 1024px;
14360+
}
14361+
14362+
.sm\:max-w-screen-xl {
14363+
max-width: 1280px;
14364+
}
14365+
1433414366
.sm\:min-h-0 {
1433514367
min-height: 0;
1433614368
}
@@ -23606,6 +23638,22 @@ video {
2360623638
max-width: 100%;
2360723639
}
2360823640

23641+
.md\:max-w-screen-sm {
23642+
max-width: 640px;
23643+
}
23644+
23645+
.md\:max-w-screen-md {
23646+
max-width: 768px;
23647+
}
23648+
23649+
.md\:max-w-screen-lg {
23650+
max-width: 1024px;
23651+
}
23652+
23653+
.md\:max-w-screen-xl {
23654+
max-width: 1280px;
23655+
}
23656+
2360923657
.md\:min-h-0 {
2361023658
min-height: 0;
2361123659
}
@@ -32881,6 +32929,22 @@ video {
3288132929
max-width: 100%;
3288232930
}
3288332931

32932+
.lg\:max-w-screen-sm {
32933+
max-width: 640px;
32934+
}
32935+
32936+
.lg\:max-w-screen-md {
32937+
max-width: 768px;
32938+
}
32939+
32940+
.lg\:max-w-screen-lg {
32941+
max-width: 1024px;
32942+
}
32943+
32944+
.lg\:max-w-screen-xl {
32945+
max-width: 1280px;
32946+
}
32947+
3288432948
.lg\:min-h-0 {
3288532949
min-height: 0;
3288632950
}
@@ -42156,6 +42220,22 @@ video {
4215642220
max-width: 100%;
4215742221
}
4215842222

42223+
.xl\:max-w-screen-sm {
42224+
max-width: 640px;
42225+
}
42226+
42227+
.xl\:max-w-screen-md {
42228+
max-width: 768px;
42229+
}
42230+
42231+
.xl\:max-w-screen-lg {
42232+
max-width: 1024px;
42233+
}
42234+
42235+
.xl\:max-w-screen-xl {
42236+
max-width: 1280px;
42237+
}
42238+
4215942239
.xl\:min-h-0 {
4216042240
min-height: 0;
4216142241
}

src/util/resolveConfig.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,17 @@ const configUtils = {
2020
{}
2121
)
2222
},
23+
breakpoints(screens) {
24+
return Object.keys(screens)
25+
.filter(key => typeof screens[key] === 'string')
26+
.reduce(
27+
(breakpoints, key) => ({
28+
...breakpoints,
29+
[`screen-${key}`]: screens[key],
30+
}),
31+
{}
32+
)
33+
},
2334
}
2435

2536
function value(valueToResolve, ...args) {

stubs/defaultConfig.stub.js

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -301,19 +301,22 @@ module.exports = {
301301
full: '100%',
302302
screen: '100vh',
303303
},
304-
maxWidth: {
305-
none: 'none',
306-
xs: '20rem',
307-
sm: '24rem',
308-
md: '28rem',
309-
lg: '32rem',
310-
xl: '36rem',
311-
'2xl': '42rem',
312-
'3xl': '48rem',
313-
'4xl': '56rem',
314-
'5xl': '64rem',
315-
'6xl': '72rem',
316-
full: '100%',
304+
maxWidth: (theme, { breakpoints }) => {
305+
return {
306+
none: 'none',
307+
xs: '20rem',
308+
sm: '24rem',
309+
md: '28rem',
310+
lg: '32rem',
311+
xl: '36rem',
312+
'2xl': '42rem',
313+
'3xl': '48rem',
314+
'4xl': '56rem',
315+
'5xl': '64rem',
316+
'6xl': '72rem',
317+
full: '100%',
318+
...breakpoints(theme('screens')),
319+
}
317320
},
318321
minHeight: {
319322
'0': '0',

0 commit comments

Comments
 (0)