Skip to content

Commit

Permalink
Add column utilities
Browse files Browse the repository at this point in the history
Co-Authored-By: Adam Wathan <[email protected]>
  • Loading branch information
reinink and adamwathan committed Sep 9, 2021
1 parent 249f6ff commit e88f611
Show file tree
Hide file tree
Showing 7 changed files with 47 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/plugins/columns.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import createUtilityPlugin from '../util/createUtilityPlugin'

export default function () {
return createUtilityPlugin('columns', [['columns', ['columns']]])
}
1 change: 1 addition & 0 deletions src/plugins/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ export { default as listStylePosition } from './listStylePosition'
export { default as listStyleType } from './listStyleType'

export { default as appearance } from './appearance'
export { default as columns } from './columns'
export { default as gridAutoColumns } from './gridAutoColumns'
export { default as gridAutoFlow } from './gridAutoFlow'
export { default as gridAutoRows } from './gridAutoRows'
Expand Down
27 changes: 27 additions & 0 deletions stubs/defaultConfig.stub.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,33 @@ module.exports = {
pink: colors.pink,
rose: colors.rose,
}),
columns: {
1: '1',
2: '2',
3: '3',
4: '4',
5: '5',
6: '6',
7: '7',
8: '8',
9: '9',
10: '10',
11: '11',
12: '12',
'3xs': '12rem',
'2xs': '16rem',
xs: '20rem',
sm: '24rem',
md: '28rem',
lg: '32rem',
xl: '36rem',
'2xl': '42rem',
'3xl': '48rem',
'4xl': '56rem',
'5xl': '64rem',
'6xl': '72rem',
'7xl': '80rem',
},
spacing: {
px: '1px',
0: '0px',
Expand Down
6 changes: 6 additions & 0 deletions tests/arbitrary-values.test.css
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,12 @@
--tw-skew-y: 3px;
transform: var(--tw-transform);
}
.columns-\[20\] {
columns: 20;
}
.columns-\[var\(--columns\)\] {
columns: var(--columns);
}
.grid-cols-\[200px\2c repeat\(auto-fill\2c minmax\(15\%\2c 100px\)\)\2c 300px\] {
grid-template-columns: 200px repeat(auto-fill, minmax(15%, 100px)) 300px;
}
Expand Down
1 change: 1 addition & 0 deletions tests/arbitrary-values.test.html
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
<div class="max-h-[var(--height)]"></div>
<div class="space-x-[20cm]"></div>
<div class="space-x-[calc(20%-1cm)]"></div>
<div class="columns-[20] columns-[var(--columns)]"></div>
<div class="grid-cols-[200px,repeat(auto-fill,minmax(15%,100px)),300px]"></div>
<div class="lg:grid-cols-[200px,repeat(auto-fill,minmax(15%,100px)),300px]"></div>
<div class="grid-rows-[200px,repeat(auto-fill,minmax(15%,100px)),300px]"></div>
Expand Down
6 changes: 6 additions & 0 deletions tests/basic-usage.test.css
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,12 @@
.appearance-none {
appearance: none;
}
.columns-1 {
columns: 1;
}
.columns-md {
columns: 28rem;
}
.auto-cols-min {
grid-auto-columns: min-content;
}
Expand Down
1 change: 1 addition & 0 deletions tests/basic-usage.test.html
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
<div class="font-medium"></div>
<div class="gap-x-2 gap-y-3 gap-4"></div>
<div class="from-red-300 via-purple-200 to-blue-400"></div>
<div class="columns-1 columns-md"></div>
<div class="auto-cols-min"></div>
<div class="grid-flow-row"></div>
<div class="auto-rows-max"></div>
Expand Down

0 comments on commit e88f611

Please sign in to comment.