mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-14 18:01:06 +00:00
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.
This commit is contained in:
parent
475acd6a5e
commit
2d3edce3ca
2 changed files with 2 additions and 2 deletions
|
@ -50,7 +50,7 @@
|
|||
{:else if story === 'inline'}
|
||||
<Button />
|
||||
{:else if story === 'icon-only buttons'}
|
||||
<Button {...iconOnlyProps} hasIconOnly />
|
||||
<Button {...iconOnlyProps} />
|
||||
{:else if story === 'set of buttons'}
|
||||
<div class={cx('--btn-set')}>
|
||||
<Button kind="secondary" {...setProps}>Secondary button</Button>
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue