refactor!: use object instead of positional arg

This commit is contained in:
Enzo Innocenzi 2020-06-28 20:46:23 +02:00
parent 109dec1681
commit dbcac5035a
No known key found for this signature in database
GPG Key ID: 142E4908E855E2B1
2 changed files with 2 additions and 2 deletions

View File

@ -99,7 +99,7 @@ test('it ignores colors that already have an alpha channel', () => {
test('it allows a closure to be passed', () => {
expect(
withAlphaVariable({
color: variable => `rgba(0, 0, 0, var(${variable}))`,
color: ({ opacityVariable }) => `rgba(0, 0, 0, var(${opacityVariable}))`,
property: 'background-color',
variable: '--bg-opacity',
})

View File

@ -21,7 +21,7 @@ function toRgba(color) {
export default function withAlphaVariable({ color, property, variable }) {
if (_.isFunction(color)) {
return {
[property]: color(variable),
[property]: color({ opacityVariable: variable }),
}
}