feat(playground): refactor PlaygroundSidebar component by removing unused changes section and reorganizing imports
This commit is contained in:
parent
1aba2bdc0f
commit
a872a33052
@ -1,10 +1,4 @@
|
||||
import * as React from "react";
|
||||
import { ChevronRight, File, Folder } from "lucide-react";
|
||||
import {
|
||||
Collapsible,
|
||||
CollapsibleContent,
|
||||
CollapsibleTrigger,
|
||||
} from "@/components/ui/collapsible";
|
||||
import {
|
||||
Sidebar,
|
||||
SidebarContent,
|
||||
@ -12,28 +6,19 @@ import {
|
||||
SidebarGroupContent,
|
||||
SidebarGroupLabel,
|
||||
SidebarMenu,
|
||||
SidebarMenuBadge,
|
||||
SidebarMenuButton,
|
||||
SidebarMenuItem,
|
||||
SidebarMenuSub,
|
||||
SidebarRail,
|
||||
} from "@/components/ui/sidebar";
|
||||
// This is sample data.
|
||||
import {
|
||||
Collapsible,
|
||||
CollapsibleContent,
|
||||
CollapsibleTrigger,
|
||||
} from "@/components/ui/collapsible";
|
||||
import { ChevronRight, File, Folder } from "lucide-react";
|
||||
|
||||
const data = {
|
||||
changes: [
|
||||
{
|
||||
file: "README.md",
|
||||
state: "M",
|
||||
},
|
||||
{
|
||||
file: "api/hello/route.ts",
|
||||
state: "U",
|
||||
},
|
||||
{
|
||||
file: "app/layout.tsx",
|
||||
state: "M",
|
||||
},
|
||||
],
|
||||
tree: [
|
||||
[
|
||||
"app",
|
||||
@ -61,28 +46,13 @@ const data = {
|
||||
"README.md",
|
||||
],
|
||||
};
|
||||
|
||||
export function PlaygroundSidebar({
|
||||
...props
|
||||
}: React.ComponentProps<typeof Sidebar>) {
|
||||
return (
|
||||
<Sidebar {...props}>
|
||||
<SidebarContent>
|
||||
<SidebarGroup>
|
||||
<SidebarGroupLabel>Changes</SidebarGroupLabel>
|
||||
<SidebarGroupContent>
|
||||
<SidebarMenu>
|
||||
{data.changes.map((item, index) => (
|
||||
<SidebarMenuItem key={index}>
|
||||
<SidebarMenuButton>
|
||||
<File />
|
||||
{item.file}
|
||||
</SidebarMenuButton>
|
||||
<SidebarMenuBadge>{item.state}</SidebarMenuBadge>
|
||||
</SidebarMenuItem>
|
||||
))}
|
||||
</SidebarMenu>
|
||||
</SidebarGroupContent>
|
||||
</SidebarGroup>
|
||||
<SidebarGroup>
|
||||
<SidebarGroupLabel>Files</SidebarGroupLabel>
|
||||
<SidebarGroupContent>
|
||||
@ -98,6 +68,7 @@ export function PlaygroundSidebar({
|
||||
</Sidebar>
|
||||
);
|
||||
}
|
||||
|
||||
function Tree({ item }: { item: string | any[] }) {
|
||||
const [name, ...items] = Array.isArray(item) ? item : [item];
|
||||
if (!items.length) {
|
||||
|
Loading…
Reference in New Issue
Block a user