2020-05-08 01:30:04 +12:00
|
|
|
<script>
|
|
|
|
export let value = ""
|
|
|
|
export let text = ""
|
|
|
|
export let icon = ""
|
2020-11-12 22:07:09 +13:00
|
|
|
export let onClick = () => {}
|
2020-05-08 01:30:04 +12:00
|
|
|
export let selected = false
|
|
|
|
|
|
|
|
$: useIcon = !!icon
|
|
|
|
</script>
|
|
|
|
|
2020-06-25 02:41:33 +12:00
|
|
|
<div class="flatbutton" class:selected on:click={() => onClick(value || text)}>
|
2020-05-08 01:30:04 +12:00
|
|
|
{#if useIcon}
|
|
|
|
<i class={icon} />
|
|
|
|
{:else}
|
2020-06-03 08:31:29 +12:00
|
|
|
<span>
|
2023-07-06 05:00:50 +12:00
|
|
|
<!-- eslint-disable-next-line svelte/no-at-html-tags -->
|
2020-06-03 08:31:29 +12:00
|
|
|
{@html text}
|
|
|
|
</span>
|
2020-05-08 01:30:04 +12:00
|
|
|
{/if}
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<style>
|
|
|
|
.flatbutton {
|
|
|
|
cursor: pointer;
|
2020-10-23 06:23:11 +13:00
|
|
|
height: 32px;
|
2020-06-24 08:29:18 +12:00
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
justify-content: center;
|
2020-05-08 01:30:04 +12:00
|
|
|
text-align: center;
|
2020-10-30 09:42:34 +13:00
|
|
|
background: var(--background);
|
2020-06-23 19:19:16 +12:00
|
|
|
color: var(--grey-7);
|
2020-10-23 06:23:11 +13:00
|
|
|
border-radius: var(--border-radius-m);
|
2021-04-23 21:48:19 +12:00
|
|
|
font-size: var(--spectrum-global-dimension-font-size-75);
|
2021-05-25 21:11:41 +12:00
|
|
|
font-weight: 600;
|
2020-05-28 20:23:36 +12:00
|
|
|
transition: all 0.3s;
|
2020-05-27 07:44:24 +12:00
|
|
|
text-rendering: optimizeLegibility;
|
2020-05-08 01:30:04 +12:00
|
|
|
}
|
|
|
|
|
|
|
|
.selected {
|
2020-10-23 06:23:11 +13:00
|
|
|
background: var(--grey-2);
|
2020-06-23 19:19:16 +12:00
|
|
|
color: var(--ink);
|
2020-05-08 01:30:04 +12:00
|
|
|
}
|
2020-06-03 08:31:29 +12:00
|
|
|
|
|
|
|
i {
|
2020-06-25 02:06:28 +12:00
|
|
|
font-size: 16px;
|
2020-05-31 05:48:20 +12:00
|
|
|
}
|
2020-05-08 01:30:04 +12:00
|
|
|
</style>
|