From dbcac5035afdf4f2e00a6fbd98e93708dcc286f1 Mon Sep 17 00:00:00 2001 From: Enzo Innocenzi Date: Sun, 28 Jun 2020 20:46:23 +0200 Subject: [PATCH] refactor!: use object instead of positional arg --- __tests__/withAlphaVariable.test.js | 2 +- src/util/withAlphaVariable.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/__tests__/withAlphaVariable.test.js b/__tests__/withAlphaVariable.test.js index 12ec2df28..11fc3a12d 100644 --- a/__tests__/withAlphaVariable.test.js +++ b/__tests__/withAlphaVariable.test.js @@ -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', }) diff --git a/src/util/withAlphaVariable.js b/src/util/withAlphaVariable.js index cd42606e0..089301baa 100644 --- a/src/util/withAlphaVariable.js +++ b/src/util/withAlphaVariable.js @@ -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 }), } }