mirror of
https://github.com/OpenCut-app/OpenCut.git
synced 2026-07-13 21:52:53 +02:00
56 lines
1.6 KiB
TypeScript
56 lines
1.6 KiB
TypeScript
import { Textarea } from "@/components/ui/textarea";
|
|||
|
|
import { Label } from "@/components/ui/label";
|
||
|
|
import {
|
||
|
|
Select,
|
||
|
|
SelectContent,
|
||
|
|
SelectItem,
|
||
|
|
SelectTrigger,
|
||
|
|
SelectValue,
|
||
|
|
} from "@/components/ui/select";
|
||
|
|
import { FONT_OPTIONS, FontFamily } from "@/constants/font-constants";
|
||
|
|
import { TextElement } from "@/types/timeline";
|
||
|
|
import { useTimelineStore } from "@/stores/timeline-store";
|
||
|
|
|
||
|
|
export function TextProperties({
|
||
|
|
element,
|
||
|
|
trackId,
|
||
|
|
}: {
|
||
|
|
element: TextElement;
|
||
|
|
trackId: string;
|
||
|
|
}) {
|
||
|
|
const { updateTextElement } = useTimelineStore();
|
||
|
|
|
||
|
|
return (
|
||
|
|
<div className="space-y-6 p-5">
|
||
|
|
<Textarea
|
||
|
|
placeholder="Name"
|
||
|
|
defaultValue={element.content}
|
||
|
|
className="min-h-[4.5rem] resize-none"
|
||
|
|
onChange={(e) =>
|
||
|
|
updateTextElement(trackId, element.id, { content: e.target.value })
|
||
|
|
}
|
||
|
|
/>
|
||
|
|
<div className="flex items-center justify-between gap-6">
|
||
|
|
<Label className="text-xs">Font</Label>
|
||
|
|
<Select
|
||
|
|
defaultValue={element.fontFamily}
|
||
|
|
onValueChange={(value: FontFamily) =>
|
||
|
|
updateTextElement(trackId, element.id, { fontFamily: value })
|
||
|
|
}
|
||
|
|
>
|
||
|
|
<SelectTrigger className="w-full text-xs">
|
||
|
|
<SelectValue placeholder="Select a font" />
|
||
|
|
</SelectTrigger>
|
||
|
|
<SelectContent>
|
||
|
|
{FONT_OPTIONS.map((font) => (
|
||
|
|
<SelectItem key={font.value} value={font.value}>
|
||
|
|
{font.label}
|
||
|
|
</SelectItem>
|
||
|
|
))}
|
||
|
|
</SelectContent>
|
||
|
|
</Select>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
);
|
||
|
|
}
|