Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
102 changes: 41 additions & 61 deletions packages/outstatic/src/components/Sidebar/CollectionsList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
SidebarGroup,
SidebarItem
} from '@/components/ui/outstatic/sidebar'
import { Folder, LayoutDashboard, Plus } from 'lucide-react'
import { Folder, Plus } from 'lucide-react'
import {
Tooltip,
TooltipProvider,
Expand All @@ -20,66 +20,46 @@ const CollectionsList = () => {
const { dashboardRoute } = useOutstatic()

return (
<>
<SidebarContent>
<SidebarItem
path={dashboardRoute}
Icon={<LayoutDashboard className="w-4" />}
>
Dashboard
</SidebarItem>
</SidebarContent>

<div className="z-10">
<Link
href={`/outstatic/new`}
className="hidden group-hover:block bg-white p-1 border border-gray-200 text-gray-500 rounded-sm hover:text-gray-700"
aria-label='Create new item in collection "collection"'
>
<Plus strokeWidth={3} size={14} />
</Link>
</div>
<SidebarContent>
<SidebarGroup key="collections" label="Collections" collapsible={false}>
{collections
? collections.map((collection) => (
<SidebarItem
key={collection.slug}
path={`${dashboardRoute}/${collection.slug}`}
Icon={<Folder className="w-4" />}
action={
<TooltipProvider>
<Tooltip>
<TooltipTrigger asChild>
<div className="z-10 w-4">
<Link
href={`/outstatic/${collection.slug}/new`}
className="hidden group-hover:block bg-white p-1 border border-gray-200 text-gray-500 rounded-sm hover:text-gray-700 w-6"
aria-label='Create new item in collection "collection"'
>
<Plus strokeWidth={3} size={14} />
</Link>
</div>
</TooltipTrigger>
<TooltipContent>
<p>
Create new{' '}
<span className="inline-block">
{singular(collection.title)}
</span>
</p>
</TooltipContent>
</Tooltip>
</TooltipProvider>
}
>
{collection.title}
</SidebarItem>
))
: null}
</SidebarGroup>
</SidebarContent>
</>
<SidebarContent>
<SidebarGroup key="collections" label="Collections" collapsible={false}>
{collections
? collections.map((collection) => (
<SidebarItem
key={collection.slug}
path={`${dashboardRoute}/${collection.slug}`}
Icon={<Folder className="w-4" />}
action={
<TooltipProvider>
<Tooltip>
<TooltipTrigger asChild>
<div className="z-10 w-4">
<Link
href={`/outstatic/${collection.slug}/new`}
className="hidden group-hover:block bg-white p-1 border border-gray-200 text-gray-500 rounded-sm hover:text-gray-700 w-6"
aria-label='Create new item in collection "collection"'
>
<Plus strokeWidth={3} size={14} />
</Link>
</div>
</TooltipTrigger>
<TooltipContent>
<p>
Create new{' '}
<span className="inline-block">
{singular(collection.title)}
</span>
</p>
</TooltipContent>
</Tooltip>
</TooltipProvider>
}
>
{collection.title}
</SidebarItem>
))
: null}
</SidebarGroup>
</SidebarContent>
)
}

Expand Down
31 changes: 25 additions & 6 deletions packages/outstatic/src/components/Sidebar/index.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import useOutstatic from '@/utils/hooks/useOutstatic'
import dynamic from 'next/dynamic'
import { cn } from '@/utils/ui'
import {
SidebarContent,
SidebarGroup,
SidebarItem,
Sidebar as SidebarUI
} from '@/components/ui/outstatic/sidebar'
import { Image, Settings } from 'lucide-react'
import useOutstatic from '@/utils/hooks/useOutstatic'
import { cn } from '@/utils/ui'
import { Image, LayoutDashboard, Plus, Settings } from 'lucide-react'
import dynamic from 'next/dynamic'
import { SidebarFooter } from './sidebar-footer'
import Link from 'next/link'

const CollectionsList = dynamic(() => import('./CollectionsList'), {
ssr: false
Expand All @@ -30,7 +31,7 @@ export const Sidebar = ({ isOpen = false }: SidebarProps) => {
aria-label="Sidebar"
>
<SidebarUI className="flex flex-col justify-between">
<div className="mt-5">
<div>
<CollectionsList />
<SidebarContent>
<SidebarGroup key="libraries" label="libraries" collapsible={false}>
Expand All @@ -42,8 +43,26 @@ export const Sidebar = ({ isOpen = false }: SidebarProps) => {
</SidebarItem>
</SidebarGroup>
</SidebarContent>
</div>
<div className="flex-col">
<div className="z-10">
<Link
href={`/outstatic/new`}
className="hidden group-hover:block bg-white p-1 border border-gray-200 text-gray-500 rounded-sm hover:text-gray-700"
aria-label='Create new item in collection "collection"'
>
<Plus strokeWidth={3} size={14} />
</Link>
</div>

<SidebarContent>
<SidebarGroup key="settings" label="settings" collapsible={false}>
<SidebarItem
path={dashboardRoute}
Icon={<LayoutDashboard className="w-4" />}
>
Dashboard
</SidebarItem>
<SidebarItem
path={`${dashboardRoute}/settings`}
Icon={<Settings className="w-4" />}
Expand All @@ -52,8 +71,8 @@ export const Sidebar = ({ isOpen = false }: SidebarProps) => {
</SidebarItem>
</SidebarGroup>
</SidebarContent>
<SidebarFooter />
</div>
<SidebarFooter />
</SidebarUI>
</div>
)
Expand Down