Skip to content
This repository was archived by the owner on Apr 6, 2021. It is now read-only.

Fix divide-style not generating, and divide-width not handling '0' properly #157

Merged
merged 1 commit into from
Mar 26, 2021
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
38 changes: 19 additions & 19 deletions src/corePlugins/divideStyle.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
const { createSimpleStaticUtilityPlugin } = require('../pluginUtils')

module.exports = createSimpleStaticUtilityPlugin({
'.divide-solid > :not([hidden]) ~ :not([hidden])': {
'border-style': 'solid',
},
'.divide-dashed > :not([hidden]) ~ :not([hidden])': {
'border-style': 'dashed',
},
'.divide-dotted > :not([hidden]) ~ :not([hidden])': {
'border-style': 'dotted',
},
'.divide-double > :not([hidden]) ~ :not([hidden])': {
'border-style': 'double',
},
'.divide-none > :not([hidden]) ~ :not([hidden])': {
'border-style': 'none',
},
})
module.exports = function ({ addUtilities }) {
addUtilities({
'.divide-solid > :not([hidden]) ~ :not([hidden])': {
'border-style': 'solid',
},
'.divide-dashed > :not([hidden]) ~ :not([hidden])': {
'border-style': 'dashed',
},
'.divide-dotted > :not([hidden]) ~ :not([hidden])': {
'border-style': 'dotted',
},
'.divide-double > :not([hidden]) ~ :not([hidden])': {
'border-style': 'double',
},
'.divide-none > :not([hidden]) ~ :not([hidden])': {
'border-style': 'none',
},
})
}
4 changes: 4 additions & 0 deletions src/corePlugins/divideWidth.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ module.exports = function ({ addUtilities, matchUtilities, jit: { theme } }) {
return []
}

value = value === '0' ? '0px' : value

return {
[`${nameClass('divide-x', modifier)} > :not([hidden]) ~ :not([hidden])`]: {
'--tw-divide-x-reverse': '0',
Expand All @@ -24,6 +26,8 @@ module.exports = function ({ addUtilities, matchUtilities, jit: { theme } }) {
return []
}

value = value === '0' ? '0px' : value

return {
[`${nameClass('divide-y', modifier)} > :not([hidden]) ~ :not([hidden])`]: {
'--tw-divide-y-reverse': '0',
Expand Down
23 changes: 23 additions & 0 deletions tests/01-basic-usage.test.css
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,29 @@
.space-x-reverse > :not([hidden]) ~ :not([hidden]) {
--tw-space-x-reverse: 1;
}
.divide-x-2 > :not([hidden]) ~ :not([hidden]) {
--tw-divide-x-reverse: 0;
border-right-width: calc(2px * var(--tw-divide-x-reverse));
border-left-width: calc(2px * calc(1 - var(--tw-divide-x-reverse)));
}
.divide-y-4 > :not([hidden]) ~ :not([hidden]) {
--tw-divide-y-reverse: 0;
border-top-width: calc(4px * calc(1 - var(--tw-divide-y-reverse)));
border-bottom-width: calc(4px * var(--tw-divide-y-reverse));
}
.divide-x-0 > :not([hidden]) ~ :not([hidden]) {
--tw-divide-x-reverse: 0;
border-right-width: calc(0px * var(--tw-divide-x-reverse));
border-left-width: calc(0px * calc(1 - var(--tw-divide-x-reverse)));
}
.divide-y-0 > :not([hidden]) ~ :not([hidden]) {
--tw-divide-y-reverse: 0;
border-top-width: calc(0px * calc(1 - var(--tw-divide-y-reverse)));
border-bottom-width: calc(0px * var(--tw-divide-y-reverse));
}
.divide-dotted > :not([hidden]) ~ :not([hidden]) {
border-style: dotted;
}
.divide-gray-200 > :not([hidden]) ~ :not([hidden]) {
--tw-divide-opacity: 1;
border-color: rgba(229, 231, 235, var(--tw-divide-opacity));
Expand Down
2 changes: 1 addition & 1 deletion tests/01-basic-usage.test.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
<div class="divide-gray-200"></div>
<div class="divide-opacity-50"></div>
<div class="divide-dotted"></div>
<div class="divide-4"></div>
<div class="divide-x-2 divide-y-4 divide-x-0 divide-y-0"></div>
<div class="fill-current"></div>
<div class="flex-1"></div>
<div class="flex-row-reverse"></div>
Expand Down