-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* refactor: placeholders * style: sort attribute
- Loading branch information
Showing
7 changed files
with
76 additions
and
96 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
12 changes: 0 additions & 12 deletions
12
src/components/editor/elements/two-columns-placeholder.tsx
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import { MapIcon, TypeIcon } from "lucide-react"; | ||
import type { EditorElementType } from "~/components/editor/type"; | ||
import { cn } from "~/lib/utils"; | ||
|
||
type PlaceholderProps = { | ||
type: EditorElementType; | ||
children?: React.ReactNode; | ||
className?: string; | ||
}; | ||
|
||
function Placeholder({ type, children, className }: PlaceholderProps) { | ||
const handleDragStart = (e: React.DragEvent) => { | ||
if (type === null) return; | ||
e.dataTransfer.setData("componentType", type); | ||
}; | ||
|
||
return ( | ||
<div | ||
draggable | ||
onDragStart={handleDragStart} | ||
className={cn( | ||
"flex h-14 w-14 cursor-grab flex-row gap-1 rounded-lg bg-muted/70 p-2 active:cursor-grabbing", | ||
className, | ||
)} | ||
> | ||
{children} | ||
</div> | ||
); | ||
} | ||
|
||
export function TextPlaceholder() { | ||
return ( | ||
<Placeholder type="text"> | ||
<TypeIcon size={40} className="text-muted-foreground" /> | ||
</Placeholder> | ||
); | ||
} | ||
|
||
export function TwoColumnsPlaceholder() { | ||
return ( | ||
<Placeholder type="2Col"> | ||
<div className="h-full w-full rounded-sm border-[1px] border-dashed border-muted-foreground/50 bg-muted"></div> | ||
<div className="h-full w-full rounded-sm border-[1px] border-dashed border-muted-foreground/50 bg-muted"></div> | ||
</Placeholder> | ||
); | ||
} | ||
|
||
export function MapPlaceholder() { | ||
return ( | ||
<Placeholder type="map"> | ||
<MapIcon size={40} className="text-muted-foreground" /> | ||
</Placeholder> | ||
); | ||
} | ||
|
||
export function ContainerPlaceholder() { | ||
return ( | ||
<Placeholder type="container"> | ||
<div className="h-full w-full rounded-sm border-[1px] border-dashed border-muted-foreground/50 bg-muted" /> | ||
</Placeholder> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters