summaryrefslogtreecommitdiff
path: root/apps/web/src/components/editor/media-panel/views/text.tsx
blob: 22fc2413cc36f1f5572348e43dc79213ae887cfd (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
import { DraggableMediaItem } from "@/components/ui/draggable-item";
import { PanelBaseView as BaseView } from "@/components/editor/panel-base-view";
import { useTimelineStore } from "@/stores/timeline-store";
import { DEFAULT_TEXT_ELEMENT } from "@/constants/text-constants";

export function TextView() {
  return (
    <BaseView>
      <DraggableMediaItem
        name="Default text"
        preview={
          <div className="flex items-center justify-center w-full h-full bg-panel-accent rounded">
            <span className="text-xs select-none">Default text</span>
          </div>
        }
        dragData={{
          id: "temp-text-id",
          type: DEFAULT_TEXT_ELEMENT.type,
          name: DEFAULT_TEXT_ELEMENT.name,
          content: DEFAULT_TEXT_ELEMENT.content,
        }}
        aspectRatio={1}
        onAddToTimeline={(currentTime) =>
          useTimelineStore.getState().addElementAtTime(
            {
              ...DEFAULT_TEXT_ELEMENT,
              id: "temp-text-id",
            },
            currentTime
          )
        }
        showLabel={false}
      />
    </BaseView>
  );
}