-
-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add font store based on current col/book * Set font based on first available font if not in choices * Show font choices in Text Appearance * Add FontSelector
- Loading branch information
Showing
8 changed files
with
153 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
<!-- | ||
@component | ||
Font Selector component. | ||
--> | ||
<script> | ||
import Modal from './Modal.svelte'; | ||
import config from '$lib/data/config'; | ||
import { | ||
convertStyle, | ||
currentFont, | ||
fontChoices, | ||
monoIconColor, | ||
s, | ||
t, | ||
themeColors | ||
} from '$lib/data/stores'; | ||
const modalId = 'fontSelector'; | ||
let modal; | ||
let selectedFont; | ||
export function showModal() { | ||
selectedFont = $currentFont; | ||
modal.showModal(); | ||
} | ||
function handleClick(font) { | ||
selectedFont = font; | ||
} | ||
function handleOk() { | ||
$currentFont = selectedFont; | ||
} | ||
</script> | ||
|
||
<Modal bind:this={modal} id={modalId} useLabel={false}> | ||
<svelte:fragment slot="content"> | ||
<ul class="dy-menu"> | ||
{#each $fontChoices as font} | ||
<!-- svelte-ignore a11y-missing-attribute --> | ||
<li style:font-family={font} style:font-size="large"> | ||
<!-- svelte-ignore a11y-click-events-have-key-events --> | ||
<a | ||
on:click={() => handleClick(font)} | ||
style:background-color={font === selectedFont | ||
? $themeColors['ButtonSelectedColor'] | ||
: ''} | ||
style:color={$monoIconColor} | ||
style:font-famly={font} | ||
> | ||
{config.fonts.find((x) => x.family === font).name} | ||
</a> | ||
</li> | ||
{/each} | ||
</ul> | ||
<div class="flex w-full justify-between dy-modal-action"> | ||
<!-- svelte-ignore a11y-click-events-have-key-events --> | ||
<button | ||
style={convertStyle($s['ui.dialog.button'])} | ||
class="dy-btn dy-btn-sm dy-btn-ghost no-animation">{$t['Button_Cancel']}</button | ||
> | ||
<!-- svelte-ignore a11y-click-events-have-key-events --> | ||
<button | ||
style={convertStyle($s['ui.dialog.button'])} | ||
class="dy-btn dy-btn-sm dy-btn-ghost no-animation" | ||
on:click={() => handleOk()}>{$t['Button_OK']}</button | ||
> | ||
</div> | ||
</svelte:fragment> | ||
</Modal> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters