From e8b0057cc44c90af24f52e44ada60493e6ef6311 Mon Sep 17 00:00:00 2001 From: Maze Winther Date: Thu, 10 Jul 2025 20:53:58 +0200 Subject: feat: initial fonts support --- apps/web/src/components/editor/preview-panel.tsx | 8 +++++++- apps/web/src/components/editor/properties-panel.tsx | 16 ++++++++++++---- apps/web/src/components/editor/timeline-element.tsx | 2 +- apps/web/src/components/editor/timeline-track.tsx | 2 +- apps/web/src/components/editor/timeline.tsx | 2 +- 5 files changed, 22 insertions(+), 8 deletions(-) (limited to 'apps/web/src/components') diff --git a/apps/web/src/components/editor/preview-panel.tsx b/apps/web/src/components/editor/preview-panel.tsx index 09341ee9..c5621fea 100644 --- a/apps/web/src/components/editor/preview-panel.tsx +++ b/apps/web/src/components/editor/preview-panel.tsx @@ -20,6 +20,7 @@ import { Play, Pause } from "lucide-react"; import { useState, useRef, useEffect } from "react"; import { cn } from "@/lib/utils"; import { formatTimeCode } from "@/lib/time"; +import { FONT_CLASS_MAP } from "@/lib/font-config"; interface ActiveElement { element: TimelineElement; @@ -141,6 +142,9 @@ export function PreviewPanel() { // Text elements if (element.type === "text") { + const fontClassName = + FONT_CLASS_MAP[element.fontFamily as keyof typeof FONT_CLASS_MAP] || ""; + return (
{element.content} diff --git a/apps/web/src/components/editor/properties-panel.tsx b/apps/web/src/components/editor/properties-panel.tsx index e9b651bc..a0532ab3 100644 --- a/apps/web/src/components/editor/properties-panel.tsx +++ b/apps/web/src/components/editor/properties-panel.tsx @@ -15,6 +15,7 @@ import { SelectValue, SelectItem, } from "../ui/select"; +import { FONT_OPTIONS, type FontFamily } from "@/constants/font-constants"; export function PropertiesPanel() { const { activeProject } = useProjectStore(); @@ -49,14 +50,21 @@ export function PropertiesPanel() { />
- + updateTextElement(trackId, element.id, { fontFamily: value }) + } + > - Arial - Helvetica - Times New Roman + {FONT_OPTIONS.map((font) => ( + + {font.label} + + ))}
diff --git a/apps/web/src/components/editor/timeline-element.tsx b/apps/web/src/components/editor/timeline-element.tsx index c5801652..1cd22c74 100644 --- a/apps/web/src/components/editor/timeline-element.tsx +++ b/apps/web/src/components/editor/timeline-element.tsx @@ -24,7 +24,7 @@ import { useTimelineElementResize } from "@/hooks/use-timeline-element-resize"; import { getTrackElementClasses, TIMELINE_CONSTANTS, -} from "@/lib/timeline-constants"; +} from "@/constants/timeline-constants"; import { DropdownMenu, DropdownMenuContent, diff --git a/apps/web/src/components/editor/timeline-track.tsx b/apps/web/src/components/editor/timeline-track.tsx index 8734d0fb..7e2e93e0 100644 --- a/apps/web/src/components/editor/timeline-track.tsx +++ b/apps/web/src/components/editor/timeline-track.tsx @@ -17,7 +17,7 @@ import type { TimelineElement as TimelineElementType, DragData, } from "@/types/timeline"; -import { TIMELINE_CONSTANTS } from "@/lib/timeline-constants"; +import { TIMELINE_CONSTANTS } from "@/constants/timeline-constants"; export function TimelineTrackContent({ track, diff --git a/apps/web/src/components/editor/timeline.tsx b/apps/web/src/components/editor/timeline.tsx index ee56cbe5..abbf5bba 100644 --- a/apps/web/src/components/editor/timeline.tsx +++ b/apps/web/src/components/editor/timeline.tsx @@ -50,7 +50,7 @@ import { getCumulativeHeightBefore, getTotalTracksHeight, TIMELINE_CONSTANTS, -} from "@/lib/timeline-constants"; +} from "@/constants/timeline-constants"; export function Timeline() { // Timeline shows all tracks (video, audio, effects) and their elements. -- cgit v1.3.1