Refator: 워크스페이스 , 프로젝트 만들기 디자인 통일
This commit is contained in:
parent
1ee2a18511
commit
2e80356cf5
@ -1,25 +1,47 @@
|
|||||||
|
import * as React from 'react';
|
||||||
import ProjectCreateForm, { ProjectCreateFormValues } from './ProjectCreateForm';
|
import ProjectCreateForm, { ProjectCreateFormValues } from './ProjectCreateForm';
|
||||||
import XIcon from '@/assets/icons/x.svg?react';
|
import { Dialog, DialogContent, DialogHeader, DialogTrigger } from '../ui/dialogCustom';
|
||||||
|
import { Button } from '@/components/ui/button';
|
||||||
|
import { Plus } from 'lucide-react';
|
||||||
|
|
||||||
export default function ProjectCreateModal({
|
export default function ProjectCreateModal({
|
||||||
onClose,
|
|
||||||
onSubmit,
|
onSubmit,
|
||||||
}: {
|
}: {
|
||||||
onClose: () => void;
|
onSubmit: (data: { title: string; labelType: 'Classification' | 'Detection' | 'Segmentation' }) => void;
|
||||||
onSubmit: (data: ProjectCreateFormValues) => void;
|
|
||||||
}) {
|
}) {
|
||||||
|
const [isOpen, setIsOpen] = React.useState(false);
|
||||||
|
|
||||||
|
const handleOpen = () => setIsOpen(true);
|
||||||
|
const handleClose = () => setIsOpen(false);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="flex w-[610px] flex-col gap-10 rounded-3xl border px-10 py-5 shadow-lg">
|
<Dialog
|
||||||
<header className="flex gap-5">
|
open={isOpen}
|
||||||
<h1 className="small-title w-full">새 프로젝트</h1>
|
onOpenChange={setIsOpen}
|
||||||
<button
|
>
|
||||||
className="flex h-8 w-8 items-center justify-center"
|
<DialogTrigger asChild>
|
||||||
onClick={onClose}
|
<Button
|
||||||
|
variant="outlinePrimary"
|
||||||
|
className="mt-4 flex items-center gap-2"
|
||||||
|
onClick={handleOpen}
|
||||||
>
|
>
|
||||||
<XIcon className="stroke-gray-900" />
|
<Plus size={16} />
|
||||||
</button>
|
<span>프로젝트 추가</span>
|
||||||
</header>
|
</Button>
|
||||||
<ProjectCreateForm onSubmit={onSubmit} />
|
</DialogTrigger>
|
||||||
</div>
|
<DialogContent>
|
||||||
|
<DialogHeader title="새 프로젝트" />
|
||||||
|
<ProjectCreateForm
|
||||||
|
onSubmit={(data: ProjectCreateFormValues) => {
|
||||||
|
const formattedData = {
|
||||||
|
title: data.projectName,
|
||||||
|
labelType: data.labelType,
|
||||||
|
};
|
||||||
|
onSubmit(formattedData);
|
||||||
|
handleClose();
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</DialogContent>
|
||||||
|
</Dialog>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -8,9 +8,6 @@ export default {
|
|||||||
|
|
||||||
export const Default = () => (
|
export const Default = () => (
|
||||||
<WorkSpaceCreateModal
|
<WorkSpaceCreateModal
|
||||||
onClose={() => {
|
|
||||||
console.log('close');
|
|
||||||
}}
|
|
||||||
onSubmit={(data) => {
|
onSubmit={(data) => {
|
||||||
console.log(data);
|
console.log(data);
|
||||||
}}
|
}}
|
||||||
|
@ -1,25 +1,44 @@
|
|||||||
|
import * as React from 'react';
|
||||||
import WorkSpaceCreateForm, { WorkSpaceCreateFormValues } from './WorkSpaceCreateForm';
|
import WorkSpaceCreateForm, { WorkSpaceCreateFormValues } from './WorkSpaceCreateForm';
|
||||||
import XIcon from '@/assets/icons/x.svg?react';
|
import { Dialog, DialogContent, DialogHeader, DialogTrigger } from '../ui/dialogCustom';
|
||||||
|
import { Plus } from 'lucide-react';
|
||||||
|
|
||||||
export default function WorkSpaceCreateModal({
|
export default function WorkSpaceCreateModal({
|
||||||
onClose,
|
|
||||||
onSubmit,
|
onSubmit,
|
||||||
}: {
|
}: {
|
||||||
onClose: () => void;
|
onSubmit: (data: { title: string; content: string }) => void;
|
||||||
onSubmit: (data: WorkSpaceCreateFormValues) => void;
|
|
||||||
}) {
|
}) {
|
||||||
|
const [isOpen, setIsOpen] = React.useState(false);
|
||||||
|
|
||||||
|
const handleOpen = () => setIsOpen(true);
|
||||||
|
const handleClose = () => setIsOpen(false);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="flex w-[610px] flex-col gap-10 rounded-3xl border px-10 py-5 shadow-lg">
|
<Dialog
|
||||||
<header className="flex gap-5">
|
open={isOpen}
|
||||||
<h1 className="small-title w-full">새 워크스페이스</h1>
|
onOpenChange={setIsOpen}
|
||||||
|
>
|
||||||
|
<DialogTrigger asChild>
|
||||||
<button
|
<button
|
||||||
className="flex h-8 w-8 items-center justify-center"
|
className="flex items-center justify-center p-2"
|
||||||
onClick={onClose}
|
onClick={handleOpen}
|
||||||
>
|
>
|
||||||
<XIcon className="stroke-gray-900" />
|
<Plus size={20} />
|
||||||
</button>
|
</button>
|
||||||
</header>
|
</DialogTrigger>
|
||||||
<WorkSpaceCreateForm onSubmit={onSubmit} />
|
<DialogContent>
|
||||||
</div>
|
<DialogHeader title="새 워크스페이스" />
|
||||||
|
<WorkSpaceCreateForm
|
||||||
|
onSubmit={(data: WorkSpaceCreateFormValues) => {
|
||||||
|
const formattedData = {
|
||||||
|
title: data.workspaceName,
|
||||||
|
content: data.workspaceDescription || '',
|
||||||
|
};
|
||||||
|
onSubmit(formattedData);
|
||||||
|
handleClose();
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</DialogContent>
|
||||||
|
</Dialog>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user