feat(displayedFontsStore): create store to manage displayed fonts sample and its content
This commit is contained in:
0
src/features/DisplayFont/index.ts
Normal file
0
src/features/DisplayFont/index.ts
Normal file
1
src/features/DisplayFont/model/index.ts
Normal file
1
src/features/DisplayFont/model/index.ts
Normal file
@@ -0,0 +1 @@
|
|||||||
|
export { displayedFontsStore } from './store';
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
import { selectedFontsStore } from '$entities/Font';
|
||||||
|
|
||||||
|
export class DisplayedFontsStore {
|
||||||
|
#sampleText = $state('The quick brown fox jumps over the lazy dog');
|
||||||
|
|
||||||
|
#displayedFonts = $derived.by(() => {
|
||||||
|
return selectedFontsStore.all;
|
||||||
|
});
|
||||||
|
|
||||||
|
get fonts() {
|
||||||
|
return this.#displayedFonts;
|
||||||
|
}
|
||||||
|
|
||||||
|
get text() {
|
||||||
|
return this.#sampleText;
|
||||||
|
}
|
||||||
|
|
||||||
|
set text(text: string) {
|
||||||
|
this.#sampleText = text;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export const displayedFontsStore = new DisplayedFontsStore();
|
||||||
1
src/features/DisplayFont/model/store/index.ts
Normal file
1
src/features/DisplayFont/model/store/index.ts
Normal file
@@ -0,0 +1 @@
|
|||||||
|
export { displayedFontsStore } from './displayedFontsStore.svelte';
|
||||||
Reference in New Issue
Block a user