Skip to content

Commit

Permalink
Fix bugs in divideOpacity and placeholderOpacity plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
adamwathan committed Apr 29, 2020
1 parent acd34ad commit d351f12
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 6 deletions.
17 changes: 15 additions & 2 deletions src/plugins/divideOpacity.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
import createUtilityPlugin from '../util/createUtilityPlugin'
import _ from 'lodash'

export default function() {
return createUtilityPlugin('divideOpacity', [['divide-opacity', ['--divide-opacity']]])
return function({ addUtilities, e, theme, variants }) {
const utilities = _.fromPairs(
_.map(theme('divideOpacity'), (value, modifier) => {
return [
`.${e(`divide-opacity-${modifier}`)} > :not(template) ~ :not(template)`,
{
'--divide-opacity': value,
},
]
})
)

addUtilities(utilities, variants('divideOpacity'))
}
}
19 changes: 15 additions & 4 deletions src/plugins/placeholderOpacity.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,18 @@
import createUtilityPlugin from '../util/createUtilityPlugin'
import _ from 'lodash'

export default function() {
return createUtilityPlugin('placeholderOpacity', [
['placeholder-opacity', ['--placeholder-opacity']],
])
return function({ addUtilities, e, theme, variants }) {
const utilities = _.fromPairs(
_.map(theme('placeholderOpacity'), (value, modifier) => {
return [
`.${e(`placeholder-opacity-${modifier}`)}::placeholder`,
{
'--placeholder-opacity': value,
},
]
})
)

addUtilities(utilities, variants('placeholderOpacity'))
}
}

0 comments on commit d351f12

Please sign in to comment.