Pass full opacityValue always
This commit is contained in:
parent
eb87ddb528
commit
a8a81e64da
3 changed files with 19 additions and 2 deletions
|
|
@ -9,6 +9,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
|
||||
- Nothing yet!
|
||||
|
||||
## [2.0.4] - 2021-03-17
|
||||
|
||||
## Fixed
|
||||
|
||||
- Pass full `var(--bg-opacity)` value as `opacityValue` when defining colors as functions
|
||||
|
||||
## [2.0.3] - 2021-02-07
|
||||
|
||||
## Fixed
|
||||
|
|
@ -1330,7 +1336,8 @@ No release notes
|
|||
|
||||
- Everything!
|
||||
|
||||
[unreleased]: https://github.com/tailwindlabs/tailwindcss/compare/v2.0.3...HEAD
|
||||
[unreleased]: https://github.com/tailwindlabs/tailwindcss/compare/v2.0.4...HEAD
|
||||
[2.0.4]: https://github.com/tailwindlabs/tailwindcss/compare/v2.0.3...v2.0.4
|
||||
[2.0.3]: https://github.com/tailwindlabs/tailwindcss/compare/v2.0.2...v2.0.3
|
||||
[2.0.2]: https://github.com/tailwindlabs/tailwindcss/compare/v2.0.1...v2.0.2
|
||||
[2.0.1]: https://github.com/tailwindlabs/tailwindcss/compare/v2.0.0...v2.0.1
|
||||
|
|
|
|||
|
|
@ -107,4 +107,14 @@ test('it allows a closure to be passed', () => {
|
|||
'--tw-bg-opacity': '1',
|
||||
'background-color': 'rgba(0, 0, 0, var(--tw-bg-opacity))',
|
||||
})
|
||||
expect(
|
||||
withAlphaVariable({
|
||||
color: ({ opacityValue }) => `rgba(0, 0, 0, ${opacityValue})`,
|
||||
property: 'background-color',
|
||||
variable: '--tw-bg-opacity',
|
||||
})
|
||||
).toEqual({
|
||||
'--tw-bg-opacity': '1',
|
||||
'background-color': 'rgba(0, 0, 0, var(--tw-bg-opacity))',
|
||||
})
|
||||
})
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ export default function withAlphaVariable({ color, property, variable }) {
|
|||
if (_.isFunction(color)) {
|
||||
return {
|
||||
[variable]: '1',
|
||||
[property]: color({ opacityVariable: variable }),
|
||||
[property]: color({ opacityVariable: variable, opacityValue: `var(${variable})` }),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue