Added a setting to allow the title's text alignment to be changed (#13235)

* Added setting to allow title text alignment to be set and changed

* Switched out for icons instead of a select as per feedback.

* Edited right icon to display the correct icon.

* Updated to use the paragrah alignment component icons.

* Added button list component

* Reworked template to use BarButtonList over ActionButton component

* Updated selectedArray name to alignmentOptions provides better meaning
This commit is contained in:
Conor Webb 2024-03-19 16:13:28 +00:00 committed by GitHub
parent 5d5c0ebebd
commit 35e1114fac
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 23 additions and 1 deletions

View File

@ -24,6 +24,13 @@
navigationStore,
} from "stores/builder"
import { DefaultAppTheme } from "constants"
import BarButtonList from "/src/components/design/settings/controls/BarButtonList.svelte"
$: alignmentOptions = [
{ value: "Left", barIcon: "TextAlignLeft" },
{ value: "Center", barIcon: "TextAlignCenter" },
{ value: "Right", barIcon: "TextAlignRight" },
]
$: screenRouteOptions = $screenStore.screens
.map(screen => screen.routing?.route)
@ -46,6 +53,10 @@
notifications.error("Error updating navigation settings")
}
}
const updateTextAlign = textAlignValue => {
navigationStore.syncAppNavigation({ textAlign: textAlignValue })
}
</script>
<Panel
@ -133,6 +144,15 @@
on:change={e => update("title", e.detail)}
updateOnChange={false}
/>
<div class="label">
<Label size="M">Text align</Label>
</div>
<BarButtonList
options={alignmentOptions}
value={$navigationStore.textAlign}
onChange={updateTextAlign}
/>
{/if}
<div class="label">
<Label>Background</Label>

View File

@ -11,6 +11,7 @@ export const INITIAL_NAVIGATION_STATE = {
hideLogo: null,
logoUrl: null,
hideTitle: null,
textAlign: "Left",
navBackground: null,
navWidth: null,
navTextColor: null,

View File

@ -36,6 +36,7 @@
export let pageWidth
export let logoLinkUrl
export let openLogoLinkInNewTab
export let textAlign
export let embedded = false
@ -226,7 +227,7 @@
{/if}
{/if}
{#if !hideTitle && title}
<Heading size="S">{title}</Heading>
<Heading size="S" {textAlign}>{title}</Heading>
{/if}
</div>
{#if !embedded}