Skip to content

Commit

Permalink
fix: add ripple style on buttons when style prop is defined
Browse files Browse the repository at this point in the history
  • Loading branch information
hperrin committed Apr 12, 2021
1 parent a3fadec commit aa65603
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions packages/button/Button.svelte
Expand Up @@ -11,6 +11,7 @@
disabled: !!$$restProps.disabled,
addClass,
removeClass,
addStyle,
},
],
forwardEvents,
Expand All @@ -32,6 +33,10 @@
'mdc-snackbar__action': context === 'snackbar:actions',
...internalClasses,
})}
style={Object.entries(internalStyles)
.map(([name, value]) => `${name}: ${value};`)
.concat([style])
.join(' ')}
{...actionProp}
{...defaultProp}
{href}
Expand All @@ -53,6 +58,7 @@
export let use = [];
let className = '';
export { className as class };
export let style = '';
export let ripple = true;
export let color = 'primary';
export let variant = 'text';
Expand All @@ -64,6 +70,7 @@
let element;
let internalClasses = {};
let internalStyles = {};
let context = getContext('SMUI:button:context');
export let component = href == null ? Button : A;
Expand Down Expand Up @@ -92,6 +99,12 @@
}
}
function addStyle(name, value) {
if (internalStyles[name] !== value) {
internalStyles[name] = value;
}
}
export function getElement() {
return element.getElement();
}
Expand Down

0 comments on commit aa65603

Please sign in to comment.