Implements Tags and Tag components
This commit is contained in:
parent
937bd03af5
commit
64b3b0f6ef
|
@ -1,11 +1,24 @@
|
|||
<div class="spectrum-Tags" role="list" aria-label="list">
|
||||
<div class="spectrum-Tags-item" role="listitem">
|
||||
<span class="spectrum-Tags-itemLabel">Tag 1</span>
|
||||
</div>
|
||||
<div class="spectrum-Tags-item is-invalid" role="listitem">
|
||||
<span class="spectrum-Tags-itemLabel">Tag 2</span>
|
||||
</div>
|
||||
<div class="spectrum-Tags-item is-disabled" role="listitem">
|
||||
<span class="spectrum-Tags-itemLabel">Tag 2</span>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
import Avatar from '../Avatar/Avatar.svelte'
|
||||
import ClearButton from '../ClearButton/ClearButton.svelte'
|
||||
export let icon = "";
|
||||
export let avatar = "";
|
||||
export let invalid = false;
|
||||
export let disabled = false;
|
||||
export let closable = false;
|
||||
</script>
|
||||
|
||||
<div class:is-invalid={invalid} class:is-disabled={disabled} class="spectrum-Tags-item" role="listitem">
|
||||
{#if avatar}
|
||||
<Avatar url={avatar} />
|
||||
{/if}
|
||||
{#if icon}
|
||||
<svg class="spectrum-Icon spectrum-Icon--sizeS" focusable="false" aria-hidden="true" aria-label="Tag">
|
||||
<use xlink:href="#spectrum-icon-24-{icon}" />
|
||||
</svg>
|
||||
{/if}
|
||||
<span class="spectrum-Tags-itemLabel"><slot /></span>
|
||||
{#if closable}
|
||||
<ClearButton on:click />
|
||||
{/if}
|
||||
</div>
|
|
@ -0,0 +1,7 @@
|
|||
<script>
|
||||
import "@spectrum-css/tags/dist/index-vars.css"
|
||||
</script>
|
||||
|
||||
<div class="spectrum-Tags" role="list" aria-label="list">
|
||||
<slot />
|
||||
</div>
|
Loading…
Reference in New Issue