From 96d803fd93163c402ed380c7b556bf4013dd8077 Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Thu, 1 Jul 2021 00:48:40 +0100 Subject: [PATCH] Only override color style on links if a color setting exists --- packages/standard-components/src/Link.svelte | 21 ++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/packages/standard-components/src/Link.svelte b/packages/standard-components/src/Link.svelte index 93cac2e309..d58d75f5c5 100644 --- a/packages/standard-components/src/Link.svelte +++ b/packages/standard-components/src/Link.svelte @@ -23,12 +23,21 @@ // Add color styles to main styles object, otherwise the styleable helper // overrides the color when it's passed as inline style. - $: styles = { - ...$component.styles, - normal: { - ...$component.styles?.normal, - color, - }, + // Add color styles to main styles object, otherwise the styleable helper + // overrides the color when it's passed as inline style. + $: styles = enrichStyles($component.styles, color) + + const enrichStyles = (styles, color) => { + if (!color) { + return styles + } + return { + ...styles, + normal: { + ...styles?.normal, + color, + }, + } }