text component
This commit is contained in:
@@ -28,6 +28,11 @@ export type EditorObject = {
|
||||
strokeWidth?: number;
|
||||
text?: string;
|
||||
fontSize?: number;
|
||||
fontFamily?: string;
|
||||
fontWeight?: string;
|
||||
letterSpacing?: number;
|
||||
wordSpacing?: number;
|
||||
opacity?: number;
|
||||
imageUrl?: string;
|
||||
videoUrl?: string;
|
||||
linkUrl?: string;
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
import { create } from "zustand";
|
||||
|
||||
export type TextDefaults = {
|
||||
fontFamily: string;
|
||||
fontWeight: string;
|
||||
fontSize: number;
|
||||
fill: string;
|
||||
opacity: number;
|
||||
letterSpacing: number;
|
||||
wordSpacing: number;
|
||||
};
|
||||
|
||||
type TextDefaultsStoreType = {
|
||||
defaults: TextDefaults;
|
||||
updateDefaults: (updates: Partial<TextDefaults>) => void;
|
||||
};
|
||||
|
||||
export const useTextDefaultsStore = create<TextDefaultsStoreType>((set) => ({
|
||||
defaults: {
|
||||
fontFamily: "1",
|
||||
fontWeight: "bold",
|
||||
fontSize: 16,
|
||||
fill: "#A27BC1",
|
||||
opacity: 100,
|
||||
letterSpacing: 10,
|
||||
wordSpacing: 10,
|
||||
},
|
||||
updateDefaults: (updates) =>
|
||||
set((state) => ({
|
||||
defaults: { ...state.defaults, ...updates },
|
||||
})),
|
||||
}));
|
||||
|
||||
Reference in New Issue
Block a user