diff options
| author | Maze Winther <mazewinther@gmail.com> | 2025-07-10 20:53:58 +0200 |
|---|---|---|
| committer | Maze Winther <mazewinther@gmail.com> | 2025-07-10 20:53:58 +0200 |
| commit | e8b0057cc44c90af24f52e44ada60493e6ef6311 (patch) | |
| tree | 9c3a09aa9de543b340a67f629fde3bd1aa85ba93 /apps/web/src/constants | |
| parent | 055a6af0551302ebfd482183eb3d682baaf9ebdd (diff) | |
| download | opencut-e8b0057cc44c90af24f52e44ada60493e6ef6311.tar.gz | |
feat: initial fonts support
Diffstat (limited to 'apps/web/src/constants')
| -rw-r--r-- | apps/web/src/constants/font-constants.ts | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/apps/web/src/constants/font-constants.ts b/apps/web/src/constants/font-constants.ts new file mode 100644 index 00000000..bfddc182 --- /dev/null +++ b/apps/web/src/constants/font-constants.ts @@ -0,0 +1,79 @@ +export interface FontOption {
+ value: string;
+ label: string;
+ category: "system" | "google" | "custom";
+ weights?: number[];
+ hasClassName?: boolean;
+}
+
+export const FONT_OPTIONS: FontOption[] = [
+ // System fonts (always available)
+ { value: "Arial", label: "Arial", category: "system", hasClassName: false },
+ {
+ value: "Helvetica",
+ label: "Helvetica",
+ category: "system",
+ hasClassName: false,
+ },
+ {
+ value: "Times New Roman",
+ label: "Times New Roman",
+ category: "system",
+ hasClassName: false,
+ },
+ {
+ value: "Georgia",
+ label: "Georgia",
+ category: "system",
+ hasClassName: false,
+ },
+
+ // Google Fonts (loaded in layout.tsx)
+ {
+ value: "Inter",
+ label: "Inter",
+ category: "google",
+ weights: [400, 700],
+ hasClassName: true,
+ },
+ {
+ value: "Roboto",
+ label: "Roboto",
+ category: "google",
+ weights: [400, 700],
+ hasClassName: true,
+ },
+ {
+ value: "Open Sans",
+ label: "Open Sans",
+ category: "google",
+ hasClassName: true,
+ },
+ {
+ value: "Playfair Display",
+ label: "Playfair Display",
+ category: "google",
+ hasClassName: true,
+ },
+ {
+ value: "Comic Neue",
+ label: "Comic Neue",
+ category: "google",
+ hasClassName: false,
+ },
+] as const;
+
+export const DEFAULT_FONT = "Arial";
+
+// Type-safe font family union
+export type FontFamily = (typeof FONT_OPTIONS)[number]["value"];
+
+// Helper functions
+export const getFontByValue = (value: string): FontOption | undefined =>
+ FONT_OPTIONS.find((font) => font.value === value);
+
+export const getGoogleFonts = (): FontOption[] =>
+ FONT_OPTIONS.filter((font) => font.category === "google");
+
+export const getSystemFonts = (): FontOption[] =>
+ FONT_OPTIONS.filter((font) => font.category === "system");
|
