2020-05-07 15:30:04 +02:00
|
|
|
<script>
|
2020-05-30 19:48:20 +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-05-30 19:48:20 +02:00
|
|
|
export let padding = "8px 2px;"
|
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-05-30 19:48:20 +02:00
|
|
|
$: style = buildStyle({padding, fontWeight})
|
2020-05-07 15:30:04 +02:00
|
|
|
$: useIcon = !!icon
|
|
|
|
</script>
|
|
|
|
|
2020-05-30 19:48:20 +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-05-30 19:48:20 +02:00
|
|
|
<span>{@html text}</span>
|
2020-05-07 15:30:04 +02:00
|
|
|
{/if}
|
|
|
|
</div>
|
|
|
|
|
2020-05-30 19:48:20 +02:00
|
|
|
|
2020-05-07 15:30:04 +02:00
|
|
|
<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-05-26 21:44:24 +02:00
|
|
|
color: var(--ink-light);
|
|
|
|
border-radius: 5px;
|
2020-05-07 15:30:04 +02:00
|
|
|
font-family: Roboto;
|
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-05-28 10:23:36 +02:00
|
|
|
background: var(--ink-light);
|
2020-05-07 15:30:04 +02:00
|
|
|
color: #ffffff;
|
|
|
|
}
|
2020-05-30 19:48:20 +02:00
|
|
|
|
|
|
|
i{
|
|
|
|
font-size: 20px;
|
|
|
|
}
|
2020-05-07 15:30:04 +02:00
|
|
|
</style>
|