From adc8cb37fcec21afac848b1e5dd724394c344050 Mon Sep 17 00:00:00 2001 From: Maze Winther Date: Wed, 27 Aug 2025 00:52:39 +0200 Subject: another huge refactor --- apps/web/src/stores/text-properties-store.ts | 33 ++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 apps/web/src/stores/text-properties-store.ts (limited to 'apps/web/src/stores') diff --git a/apps/web/src/stores/text-properties-store.ts b/apps/web/src/stores/text-properties-store.ts new file mode 100644 index 00000000..b3ce3689 --- /dev/null +++ b/apps/web/src/stores/text-properties-store.ts @@ -0,0 +1,33 @@ +import { create } from "zustand"; +import { persist } from "zustand/middleware"; + +export type TextPropertiesTab = "transform" | "style"; + +export interface TextPropertiesTabMeta { + value: TextPropertiesTab; + label: string; +} + +export const TEXT_PROPERTIES_TABS: ReadonlyArray = [ + { value: "transform", label: "Transform" }, + { value: "style", label: "Style" }, +] as const; + +export function isTextPropertiesTab(value: string): value is TextPropertiesTab { + return TEXT_PROPERTIES_TABS.some((t) => t.value === value); +} + +interface TextPropertiesState { + activeTab: TextPropertiesTab; + setActiveTab: (tab: TextPropertiesTab) => void; +} + +export const useTextPropertiesStore = create()( + persist( + (set) => ({ + activeTab: "transform", + setActiveTab: (tab) => set({ activeTab: tab }), + }), + { name: "text-properties" } + ) +); -- cgit v1.3.1