Skip to content

Commit

Permalink
fix(lineargradient): fix issue with rgba value as the first color stop
Browse files Browse the repository at this point in the history
Fixes issue with rgba values having spaces and being used at the first color stop value.

fix #538
  • Loading branch information
bhough committed Sep 19, 2020
1 parent cb3c0fc commit 5a5a020
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "polished",
"version": "3.6.6",
"version": "3.6.7",
"description": "A lightweight toolset for writing styles in Javascript.",
"license": "MIT",
"author": "Brian Hough <hello@brianhough.net> (https://polished.js.org)",
Expand Down
13 changes: 9 additions & 4 deletions src/mixins/linearGradient.js
Expand Up @@ -43,9 +43,14 @@ export default function linearGradient({
throw new PolishedError(56)
}
return {
backgroundColor: fallback || colorStops[0].split(' ')[0],
backgroundImage: constructGradientValue`linear-gradient(${toDirection}${colorStops.join(
', ',
)})`,
backgroundColor:
fallback
|| colorStops[0]
.replace(/,\s+/g, ',')
.split(' ')[0]
.replace(/,(?=\S)/g, ', '),
backgroundImage: constructGradientValue`linear-gradient(${toDirection}${colorStops
.join(', ')
.replace(/,(?=\S)/g, ', ')})`,
}
}

0 comments on commit 5a5a020

Please sign in to comment.