1
0
Fork 0
mirror of synced 2024-07-16 03:35:56 +12:00
budibase/packages/standard-components/src/Text.svelte

30 lines
559 B
Svelte
Raw Normal View History

<script>
import { getContext } from "svelte"
2021-06-11 22:37:05 +12:00
const { styleable, builderStore } = getContext("sdk")
const component = getContext("component")
2021-06-11 22:37:05 +12:00
export let text
2021-06-11 22:37:05 +12:00
$: placeholder = $builderStore.inBuilder && !text
$: componentText = $builderStore.inBuilder
? text || "Placeholder text"
: text || ""
</script>
2021-06-11 22:37:05 +12:00
<p use:styleable={$component.styles} class:placeholder>
{componentText}
</p>
<style>
2021-02-23 23:04:07 +13:00
p {
display: inline-block;
2021-02-23 23:04:07 +13:00
white-space: pre-wrap;
}
2021-06-11 22:37:05 +12:00
.placeholder {
font-style: italic;
2021-06-11 22:37:05 +12:00
color: var(--grey-6);
}
</style>