From 2d3edce3ca40bd1522f687a58583174a1afb4fce Mon Sep 17 00:00:00 2001 From: Eric Liu Date: Mon, 23 Dec 2019 18:46:22 -0800 Subject: [PATCH] feat(button): derive hasIconOnly from icon and slots Instead of explicitly defining hasIconOnly, its value can be inferred from a falsy icon prop and an empty slot. --- src/components/Button/Button.Story.svelte | 2 +- src/components/Button/Button.svelte | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/Button/Button.Story.svelte b/src/components/Button/Button.Story.svelte index b6e09c9c..146fe6d5 100644 --- a/src/components/Button/Button.Story.svelte +++ b/src/components/Button/Button.Story.svelte @@ -50,7 +50,7 @@ {:else if story === 'inline'} diff --git a/src/components/Button/Button.svelte b/src/components/Button/Button.svelte index af9b9691..7ba6e1e6 100644 --- a/src/components/Button/Button.svelte +++ b/src/components/Button/Button.svelte @@ -11,7 +11,6 @@ export let type = 'button'; export let icon = undefined; export let iconDescription = undefined; - export let hasIconOnly = false; export let tooltipPosition = undefined; export let tooltipAlignment = undefined; export let style = undefined; @@ -19,6 +18,7 @@ import { getContext } from 'svelte'; import { cx } from '../../lib'; + const hasIconOnly = !!icon && !$$props.$$slots; const ctx = getContext('ComposedModal'); let buttonRef = undefined;