-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
File creation, UI changes and context-menu
- Loading branch information
1 parent
6b306ab
commit 72b7579
Showing
6 changed files
with
734 additions
and
145 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
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,48 @@ | ||
import * as React from "react"; | ||
import { | ||
ContextMenu, | ||
ContextMenuContent, | ||
ContextMenuItem, | ||
ContextMenuTrigger, | ||
} from "@/components/ui/context-menu"; | ||
import { File, Folder, Trash2 } from "lucide-react"; | ||
|
||
interface FileExplorerContextMenuProps { | ||
children: React.ReactNode; | ||
onNewFile: () => void; | ||
onNewFolder: () => void; | ||
onDelete: () => void; | ||
isFolder: boolean; | ||
} | ||
|
||
export function FileExplorerContextMenu({ | ||
children, | ||
onNewFile, | ||
onNewFolder, | ||
onDelete, | ||
isFolder, | ||
}: FileExplorerContextMenuProps) { | ||
return ( | ||
<ContextMenu> | ||
<ContextMenuTrigger>{children}</ContextMenuTrigger> | ||
<ContextMenuContent className="w-64"> | ||
{isFolder && ( | ||
<> | ||
<ContextMenuItem onSelect={onNewFile}> | ||
<File className="mr-2 h-4 w-4" /> | ||
New File | ||
</ContextMenuItem> | ||
<ContextMenuItem onSelect={onNewFolder}> | ||
<Folder className="mr-2 h-4 w-4" /> | ||
New Folder | ||
</ContextMenuItem> | ||
</> | ||
)} | ||
<ContextMenuItem onSelect={onDelete} className="text-red-600"> | ||
<Trash2 className="mr-2 h-4 w-4" /> | ||
Delete | ||
</ContextMenuItem> | ||
</ContextMenuContent> | ||
</ContextMenu> | ||
); | ||
} |
Oops, something went wrong.