Refactor: 워크스페이스 레이아웃에서 워크스페이스가 없을 경우 추가, 스토리북 추가

This commit is contained in:
정현조 2024-09-09 15:02:32 +09:00
parent 95e9af7ff1
commit cc59481687
2 changed files with 36 additions and 11 deletions

View File

@ -0,0 +1,23 @@
import '@/index.css';
import { Meta, StoryObj } from '@storybook/react';
import WorkspaceBrowseLayout from '.';
const meta: Meta<typeof WorkspaceBrowseLayout> = {
title: 'Layout/WorkspaceBrowseLayout',
component: WorkspaceBrowseLayout,
parameters: {
layout: 'fullscreen',
},
};
export default meta;
type Story = StoryObj<typeof WorkspaceBrowseLayout>;
export const Default: Story = {
render: () => <WorkspaceBrowseLayout />,
};
export const Empty: Story = {
render: () => <WorkspaceBrowseLayout />,
};

View File

@ -1,7 +1,6 @@
import { Suspense } from 'react'; import { Suspense } from 'react';
import { NavLink, Outlet } from 'react-router-dom'; import { NavLink, Outlet } from 'react-router-dom';
import Header from '../Header'; import Header from '../Header';
import Footer from '../Footer';
import { Workspace } from '@/types'; import { Workspace } from '@/types';
import { Dialog, DialogContent, DialogHeader, DialogTrigger } from '../ui/dialogCustom'; import { Dialog, DialogContent, DialogHeader, DialogTrigger } from '../ui/dialogCustom';
import { Plus } from 'lucide-react'; import { Plus } from 'lucide-react';
@ -60,15 +59,19 @@ export default function WorkspaceBrowseLayout() {
</DialogContent> </DialogContent>
</Dialog> </Dialog>
</div> </div>
{workspaces.map((workspace) => ( {workspaces.length > 0 ? (
<NavLink workspaces.map((workspace) => (
to={`/browse/${workspace.id}`} <NavLink
key={workspace.id} to={`/browse/${workspace.id}`}
className={({ isActive }) => (isActive ? 'body-strong' : 'body') + ' cursor-pointer'} key={workspace.id}
> className={({ isActive }) => (isActive ? 'body-strong' : 'body') + ' cursor-pointer'}
{workspace.name} >
</NavLink> {workspace.name}
))} </NavLink>
))
) : (
<p className="text-gray-500"> .</p>
)}
</div> </div>
<div className="flex w-[calc(100%-280px)] flex-col gap-24"> <div className="flex w-[calc(100%-280px)] flex-col gap-24">
<Suspense fallback={<div></div>}> <Suspense fallback={<div></div>}>
@ -76,7 +79,6 @@ export default function WorkspaceBrowseLayout() {
<Outlet /> <Outlet />
</main> </main>
</Suspense> </Suspense>
<Footer className="mt-0" />
</div> </div>
</div> </div>
</div> </div>