Skip to content

Commit

Permalink
Merge pull request tailwindlabs#1284 from tailwindcss/max-w-screen
Browse files Browse the repository at this point in the history
Add `max-w-screen-{breakpoint}` utilities
  • Loading branch information
adamwathan authored Dec 27, 2019
2 parents 2ae6c56 + 038b158 commit 63b5cc2
Show file tree
Hide file tree
Showing 4 changed files with 187 additions and 13 deletions.
80 changes: 80 additions & 0 deletions __tests__/fixtures/tailwind-output-important.css
Original file line number Diff line number Diff line change
Expand Up @@ -5117,6 +5117,22 @@ video {
max-width: 100% !important;
}

.max-w-screen-sm {
max-width: 640px !important;
}

.max-w-screen-md {
max-width: 768px !important;
}

.max-w-screen-lg {
max-width: 1024px !important;
}

.max-w-screen-xl {
max-width: 1280px !important;
}

.min-h-0 {
min-height: 0 !important;
}
Expand Down Expand Up @@ -14451,6 +14467,22 @@ video {
max-width: 100% !important;
}

.sm\:max-w-screen-sm {
max-width: 640px !important;
}

.sm\:max-w-screen-md {
max-width: 768px !important;
}

.sm\:max-w-screen-lg {
max-width: 1024px !important;
}

.sm\:max-w-screen-xl {
max-width: 1280px !important;
}

.sm\:min-h-0 {
min-height: 0 !important;
}
Expand Down Expand Up @@ -23786,6 +23818,22 @@ video {
max-width: 100% !important;
}

.md\:max-w-screen-sm {
max-width: 640px !important;
}

.md\:max-w-screen-md {
max-width: 768px !important;
}

.md\:max-w-screen-lg {
max-width: 1024px !important;
}

.md\:max-w-screen-xl {
max-width: 1280px !important;
}

.md\:min-h-0 {
min-height: 0 !important;
}
Expand Down Expand Up @@ -33121,6 +33169,22 @@ video {
max-width: 100% !important;
}

.lg\:max-w-screen-sm {
max-width: 640px !important;
}

.lg\:max-w-screen-md {
max-width: 768px !important;
}

.lg\:max-w-screen-lg {
max-width: 1024px !important;
}

.lg\:max-w-screen-xl {
max-width: 1280px !important;
}

.lg\:min-h-0 {
min-height: 0 !important;
}
Expand Down Expand Up @@ -42456,6 +42520,22 @@ video {
max-width: 100% !important;
}

.xl\:max-w-screen-sm {
max-width: 640px !important;
}

.xl\:max-w-screen-md {
max-width: 768px !important;
}

.xl\:max-w-screen-lg {
max-width: 1024px !important;
}

.xl\:max-w-screen-xl {
max-width: 1280px !important;
}

.xl\:min-h-0 {
min-height: 0 !important;
}
Expand Down
80 changes: 80 additions & 0 deletions __tests__/fixtures/tailwind-output.css
Original file line number Diff line number Diff line change
Expand Up @@ -5117,6 +5117,22 @@ video {
max-width: 100%;
}

.max-w-screen-sm {
max-width: 640px;
}

.max-w-screen-md {
max-width: 768px;
}

.max-w-screen-lg {
max-width: 1024px;
}

.max-w-screen-xl {
max-width: 1280px;
}

.min-h-0 {
min-height: 0;
}
Expand Down Expand Up @@ -14451,6 +14467,22 @@ video {
max-width: 100%;
}

.sm\:max-w-screen-sm {
max-width: 640px;
}

.sm\:max-w-screen-md {
max-width: 768px;
}

.sm\:max-w-screen-lg {
max-width: 1024px;
}

.sm\:max-w-screen-xl {
max-width: 1280px;
}

.sm\:min-h-0 {
min-height: 0;
}
Expand Down Expand Up @@ -23786,6 +23818,22 @@ video {
max-width: 100%;
}

.md\:max-w-screen-sm {
max-width: 640px;
}

.md\:max-w-screen-md {
max-width: 768px;
}

.md\:max-w-screen-lg {
max-width: 1024px;
}

.md\:max-w-screen-xl {
max-width: 1280px;
}

.md\:min-h-0 {
min-height: 0;
}
Expand Down Expand Up @@ -33121,6 +33169,22 @@ video {
max-width: 100%;
}

.lg\:max-w-screen-sm {
max-width: 640px;
}

.lg\:max-w-screen-md {
max-width: 768px;
}

.lg\:max-w-screen-lg {
max-width: 1024px;
}

.lg\:max-w-screen-xl {
max-width: 1280px;
}

.lg\:min-h-0 {
min-height: 0;
}
Expand Down Expand Up @@ -42456,6 +42520,22 @@ video {
max-width: 100%;
}

.xl\:max-w-screen-sm {
max-width: 640px;
}

.xl\:max-w-screen-md {
max-width: 768px;
}

.xl\:max-w-screen-lg {
max-width: 1024px;
}

.xl\:max-w-screen-xl {
max-width: 1280px;
}

.xl\:min-h-0 {
min-height: 0;
}
Expand Down
11 changes: 11 additions & 0 deletions src/util/resolveConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,17 @@ const configUtils = {
{}
)
},
breakpoints(screens) {
return Object.keys(screens)
.filter(key => typeof screens[key] === 'string')
.reduce(
(breakpoints, key) => ({
...breakpoints,
[`screen-${key}`]: screens[key],
}),
{}
)
},
}

function value(valueToResolve, ...args) {
Expand Down
29 changes: 16 additions & 13 deletions stubs/defaultConfig.stub.js
Original file line number Diff line number Diff line change
Expand Up @@ -302,19 +302,22 @@ module.exports = {
full: '100%',
screen: '100vh',
},
maxWidth: {
none: 'none',
xs: '20rem',
sm: '24rem',
md: '28rem',
lg: '32rem',
xl: '36rem',
'2xl': '42rem',
'3xl': '48rem',
'4xl': '56rem',
'5xl': '64rem',
'6xl': '72rem',
full: '100%',
maxWidth: (theme, { breakpoints }) => {
return {
none: 'none',
xs: '20rem',
sm: '24rem',
md: '28rem',
lg: '32rem',
xl: '36rem',
'2xl': '42rem',
'3xl': '48rem',
'4xl': '56rem',
'5xl': '64rem',
'6xl': '72rem',
full: '100%',
...breakpoints(theme('screens')),
}
},
minHeight: {
'0': '0',
Expand Down

0 comments on commit 63b5cc2

Please sign in to comment.