mirror of
https://github.com/OpenCut-app/OpenCut.git
synced 2026-07-13 21:52:53 +02:00
another fix
This commit is contained in:
@@ -2,6 +2,11 @@
|
|||||||
|
|
||||||
import { AspectRatio } from "@/components/ui/aspect-ratio";
|
import { AspectRatio } from "@/components/ui/aspect-ratio";
|
||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
|
import {
|
||||||
|
Tooltip,
|
||||||
|
TooltipContent,
|
||||||
|
TooltipTrigger,
|
||||||
|
} from "@/components/ui/tooltip";
|
||||||
import { ReactNode, useState, useRef, useEffect } from "react";
|
import { ReactNode, useState, useRef, useEffect } from "react";
|
||||||
import { createPortal } from "react-dom";
|
import { createPortal } from "react-dom";
|
||||||
import { Plus } from "lucide-react";
|
import { Plus } from "lucide-react";
|
||||||
@@ -139,7 +144,12 @@ export function DraggableMediaItem({
|
|||||||
<div className="w-full h-full [&_img]:w-full [&_img]:h-full [&_img]:object-cover [&_img]:rounded-none">
|
<div className="w-full h-full [&_img]:w-full [&_img]:h-full [&_img]:object-cover [&_img]:rounded-none">
|
||||||
{preview}
|
{preview}
|
||||||
</div>
|
</div>
|
||||||
{showPlusOnDrag && <PlusButton onClick={handleAddToTimeline} tooltipText="Add to timeline or drag to position" />}
|
{showPlusOnDrag && (
|
||||||
|
<PlusButton
|
||||||
|
onClick={handleAddToTimeline}
|
||||||
|
tooltipText="Add to timeline or drag to position"
|
||||||
|
/>
|
||||||
|
)}
|
||||||
</AspectRatio>
|
</AspectRatio>
|
||||||
</div>
|
</div>
|
||||||
</div>,
|
</div>,
|
||||||
@@ -149,8 +159,16 @@ export function DraggableMediaItem({
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function PlusButton({ className, onClick }: { className?: string; onClick?: () => void }) {
|
function PlusButton({
|
||||||
return (
|
className,
|
||||||
|
onClick,
|
||||||
|
tooltipText,
|
||||||
|
}: {
|
||||||
|
className?: string;
|
||||||
|
onClick?: () => void;
|
||||||
|
tooltipText?: string;
|
||||||
|
}) {
|
||||||
|
const button = (
|
||||||
<Button
|
<Button
|
||||||
size="icon"
|
size="icon"
|
||||||
className={cn("absolute bottom-2 right-2 size-4", className)}
|
className={cn("absolute bottom-2 right-2 size-4", className)}
|
||||||
@@ -163,4 +181,17 @@ function PlusButton({ className, onClick }: { className?: string; onClick?: () =
|
|||||||
<Plus className="!size-3" />
|
<Plus className="!size-3" />
|
||||||
</Button>
|
</Button>
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (tooltipText) {
|
||||||
|
return (
|
||||||
|
<Tooltip>
|
||||||
|
<TooltipTrigger asChild>{button}</TooltipTrigger>
|
||||||
|
<TooltipContent>
|
||||||
|
<p>{tooltipText}</p>
|
||||||
|
</TooltipContent>
|
||||||
|
</Tooltip>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return button;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user