budibase/packages/builder/src/components/userInterface/FlatButton.svelte

48 lines
909 B
Svelte
Raw Normal View History

2020-05-07 15:30:04 +02:00
<script>
import { buildStyle } from "../../helpers.js"
2020-05-07 15:30:04 +02:00
export let value = ""
export let text = ""
export let icon = ""
export let onClick = (value) => {}
2020-05-07 15:30:04 +02:00
export let selected = false
$: useIcon = !!icon
</script>
2020-06-24 16:41:33 +02:00
<div class="flatbutton" class:selected on:click={() => onClick(value || text)}>
2020-05-07 15:30:04 +02:00
{#if useIcon}
<i class={icon} />
{:else}
<span>
{@html text}
</span>
2020-05-07 15:30:04 +02:00
{/if}
</div>
<style>
.flatbutton {
cursor: pointer;
height: 32px;
display: flex;
align-items: center;
justify-content: center;
2020-05-07 15:30:04 +02:00
text-align: center;
background: white;
color: var(--grey-7);
border-radius: var(--border-radius-m);
font-size: var(--font-size-xs);
font-weight: 500;
2020-05-28 10:23:36 +02:00
transition: all 0.3s;
text-rendering: optimizeLegibility;
2020-05-07 15:30:04 +02:00
}
.selected {
background: var(--grey-2);
color: var(--ink);
2020-05-07 15:30:04 +02:00
}
i {
font-size: 16px;
}
2020-05-07 15:30:04 +02:00
</style>