From 5a5a020a5f44f767536d7bdac71a9dd6a8a3d11b Mon Sep 17 00:00:00 2001 From: Brian Hough Date: Sat, 19 Sep 2020 18:56:12 -0400 Subject: [PATCH] fix(lineargradient): fix issue with rgba value as the first color stop Fixes issue with rgba values having spaces and being used at the first color stop value. fix #538 --- package.json | 2 +- src/mixins/linearGradient.js | 13 +++++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index d9fa6779..9e8a0595 100644 --- a/package.json +++ b/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 (https://polished.js.org)", diff --git a/src/mixins/linearGradient.js b/src/mixins/linearGradient.js index 94a65aca..c69f3451 100644 --- a/src/mixins/linearGradient.js +++ b/src/mixins/linearGradient.js @@ -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, ', ')})`, } }