2020-05-07 15:30:04 +02:00
|
|
|
<script>
|
2020-06-02 22:31:29 +02:00
|
|
|
import { buildStyle } from "../../helpers.js"
|
2020-05-07 15:30:04 +02:00
|
|
|
export let value = ""
|
|
|
|
export let text = ""
|
|
|
|
export let icon = ""
|
2020-06-01 17:31:58 +02:00
|
|
|
export let padding = "8px 5px;"
|
2020-05-07 15:30:04 +02:00
|
|
|
export let onClick = value => {}
|
|
|
|
export let selected = false
|
2020-05-30 19:48:20 +02:00
|
|
|
export let fontWeight = ""
|
2020-05-07 15:30:04 +02:00
|
|
|
|
2020-06-02 22:31:29 +02:00
|
|
|
$: style = buildStyle({ padding, fontWeight })
|
2020-05-07 15:30:04 +02:00
|
|
|
$: useIcon = !!icon
|
|
|
|
</script>
|
|
|
|
|
2020-06-02 22:31:29 +02:00
|
|
|
<div
|
|
|
|
class="flatbutton"
|
|
|
|
{style}
|
|
|
|
class:selected
|
|
|
|
on:click={() => onClick(value || text)}>
|
2020-05-07 15:30:04 +02:00
|
|
|
{#if useIcon}
|
|
|
|
<i class={icon} />
|
|
|
|
{:else}
|
2020-06-02 22:31:29 +02:00
|
|
|
<span>
|
|
|
|
{@html text}
|
|
|
|
</span>
|
2020-05-07 15:30:04 +02:00
|
|
|
{/if}
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<style>
|
|
|
|
.flatbutton {
|
|
|
|
cursor: pointer;
|
2020-05-28 10:23:36 +02:00
|
|
|
padding: 8px 2px;
|
2020-05-07 15:30:04 +02:00
|
|
|
text-align: center;
|
|
|
|
background: #ffffff;
|
2020-06-23 09:19:16 +02:00
|
|
|
color: var(--grey-7);
|
2020-05-26 21:44:24 +02:00
|
|
|
border-radius: 5px;
|
2020-05-28 10:23:36 +02:00
|
|
|
font-size: 14px;
|
|
|
|
font-weight: 400;
|
|
|
|
transition: all 0.3s;
|
2020-05-30 19:48:20 +02:00
|
|
|
margin-left: 5px;
|
2020-05-26 21:44:24 +02:00
|
|
|
text-rendering: optimizeLegibility;
|
2020-05-07 15:30:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
.selected {
|
2020-06-23 09:19:16 +02:00
|
|
|
background: var(--grey-3);
|
|
|
|
color: var(--ink);
|
2020-05-07 15:30:04 +02:00
|
|
|
}
|
2020-06-02 22:31:29 +02:00
|
|
|
|
|
|
|
i {
|
2020-05-30 19:48:20 +02:00
|
|
|
font-size: 20px;
|
|
|
|
}
|
2020-05-07 15:30:04 +02:00
|
|
|
</style>
|