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

49 lines
962 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 padding = "8px 2px;"
2020-05-07 15:30:04 +02:00
export let onClick = value => {}
export let selected = false
export let fontWeight = ""
2020-05-07 15:30:04 +02:00
$: style = buildStyle({padding, fontWeight})
2020-05-07 15:30:04 +02:00
$: useIcon = !!icon
</script>
<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}
<span>{@html text}</span>
2020-05-07 15:30:04 +02:00
{/if}
</div>
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;
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;
margin-left: 5px;
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;
}
i{
font-size: 20px;
}
2020-05-07 15:30:04 +02:00
</style>