diff --git a/packages/standard-components/manifest.json b/packages/standard-components/manifest.json index 5cca0d7e3d..63c801f289 100644 --- a/packages/standard-components/manifest.json +++ b/packages/standard-components/manifest.json @@ -867,6 +867,7 @@ "name": "Link", "description": "A basic link component for internal and external links", "icon": "Link", + "showSettingsBar": true, "illegalChildren": ["section"], "settings": [ { @@ -885,10 +886,85 @@ "label": "New Tab", "key": "openInNewTab" }, + { + "type": "select", + "label": "Size", + "key": "size", + "defaultValue": "M", + "showInBar": true, + "barStyle": "picker", + "options": [{ + "label": "Small", + "value": "S" + }, { + "label": "Medium", + "value": "M" + }, { + "label": "Large", + "value": "L" + }] + }, + { + "type": "color", + "label": "Color", + "key": "color", + "showInBar": true, + "barSeparator": false + }, { "type": "boolean", - "label": "External", - "key": "external" + "label": "Bold", + "key": "bold", + "showInBar": true, + "barIcon": "TagBold", + "barTitle": "Bold text", + "barSeparator": false + }, + { + "type": "boolean", + "label": "Italic", + "key": "italic", + "showInBar": true, + "barIcon": "TagItalic", + "barTitle": "Italic text", + "barSeparator": false + }, + { + "type": "boolean", + "label": "Underline", + "key": "underline", + "showInBar": true, + "barIcon": "TagUnderline", + "barTitle": "Underline text" + }, + { + "type": "select", + "label": "Alignment", + "key": "align", + "defaultValue": "left", + "showInBar": true, + "barStyle": "buttons", + "options": [{ + "label": "Left", + "value": "left", + "barIcon": "TextAlignLeft", + "barTitle": "Align left" + }, { + "label": "Center", + "value": "center", + "barIcon": "TextAlignCenter", + "barTitle": "Align center" + }, { + "label": "Right", + "value": "right", + "barIcon": "TextAlignRight", + "barTitle": "Align right" + }, { + "label": "Justify", + "value": "justify", + "barIcon": "TextAlignJustify", + "barTitle": "Justify text" + }] } ] }, diff --git a/packages/standard-components/src/BackgroundImage.svelte b/packages/standard-components/src/BackgroundImage.svelte index 14025323f3..96befe560a 100644 --- a/packages/standard-components/src/BackgroundImage.svelte +++ b/packages/standard-components/src/BackgroundImage.svelte @@ -2,7 +2,7 @@ import { getContext } from "svelte" import Placeholder from "./Placeholder.svelte" - const { styleable } = getContext("sdk") + const { styleable, builderStore } = getContext("sdk") const component = getContext("component") export let url @@ -23,7 +23,7 @@
-{:else} +{:else if $builderStore.inBuilder}
-{:else} +{:else if $builderStore.inBuilder}
import { getContext } from "svelte" - const { linkable, styleable } = getContext("sdk") + const { linkable, styleable, builderStore } = getContext("sdk") const component = getContext("component") - export let url = "" - export let text = "" - export let openInNewTab = false - export let external = false + export let url + export let text + export let openInNewTab + export let color + export let align + export let bold + export let italic + export let underline + export let size + $: external = url && !url.startsWith("/") $: target = openInNewTab ? "_blank" : "_self" + $: placeholder = $builderStore.inBuilder && !text + $: componentText = $builderStore.inBuilder + ? text || "Placeholder link" + : text || "" + + // Add color styles to main styles object, otherwise the styleable helper + // overrides the color when it's passed as inline style. + $: styles = { + ...$component.styles, + normal: { + ...$component.styles?.normal, + color, + }, + } -{#if external} - - {text} - - -{:else} - - {text} - - +{#if $builderStore.inBuilder || componentText} + {#if external} + + {componentText} + + {:else} + + {componentText} + + {/if} {/if}