Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issue where container padding not applied when using object syntax #2353

Merged
merged 2 commits into from
Sep 9, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

- Nothing yet!
- Fix issue where container padding not applied when using object syntax ([#2353](https://github.com/tailwindlabs/tailwindcss/pull/2353))

## [1.8.5] - 2020-09-07

Expand Down
6 changes: 6 additions & 0 deletions __tests__/containerPlugin.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,12 @@ test('responsive horizontal padding can be included by default', () => {
[container()],
config({
theme: {
screens: {
sm: '576px',
md: { min: '768px' },
lg: { 'min-width': '992px' },
xl: { min: '1200px', max: '1600px' },
},
container: {
padding: {
default: '1rem',
Expand Down
6 changes: 5 additions & 1 deletion src/plugins/container.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,11 @@ function mapMinWidthsToPadding(minWidths, screens, paddings) {

_.each(minWidths, minWidth => {
Object.keys(screens).forEach(screen => {
if (`${screens[screen]}` === `${minWidth}`) {
const screenMinWidth = _.isPlainObject(screens[screen])
? screens[screen].min || screens[screen]['min-width']
: screens[screen]

if (`${screenMinWidth}` === `${minWidth}`) {
mapping.push({
screen,
minWidth,
Expand Down