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