summaryrefslogtreecommitdiff
path: root/apps/web/src/constants/font-constants.ts
blob: bfddc182a67a5e65fce9d99cafe9a45e1381e490 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
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");