Skip to content

Commit

Permalink
simplify inset plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
RobinMalfait committed Sep 24, 2021
1 parent ab17c6c commit 87da0a1
Showing 1 changed file with 13 additions and 29 deletions.
42 changes: 13 additions & 29 deletions src/corePlugins.js
Original file line number Diff line number Diff line change
Expand Up @@ -520,35 +520,19 @@ export let position = ({ addUtilities }) => {
})
}

export let inset = ({ matchUtilities, theme }) => {
let options = {
values: theme('inset'),
type: 'any',
}

matchUtilities(
{ inset: (value) => ({ top: value, right: value, bottom: value, left: value }) },
options
)

matchUtilities(
{
'inset-x': (value) => ({ left: value, right: value }),
'inset-y': (value) => ({ top: value, bottom: value }),
},
options
)

matchUtilities(
{
top: (top) => ({ top }),
right: (right) => ({ right }),
bottom: (bottom) => ({ bottom }),
left: (left) => ({ left }),
},
options
)
}
export let inset = createUtilityPlugin('inset', [
['inset', ['top', 'right', 'bottom', 'left']],
[
['inset-x', ['left', 'right']],
['inset-y', ['top', 'bottom']],
],
[
['top', ['top']],
['right', ['right']],
['bottom', ['bottom']],
['left', ['left']],
],
])

export let isolation = ({ addUtilities }) => {
addUtilities({
Expand Down

0 comments on commit 87da0a1

Please sign in to comment.