Design: 버튼 디자인 통일, 프로젝트 생성 컴포넌트 디자인 리팩토링

This commit is contained in:
홍창기 2024-09-30 18:23:33 +09:00
parent 8cd7d545fb
commit 191f2e04de
23 changed files with 74 additions and 88 deletions

View File

@ -65,7 +65,7 @@ export default function AdminProjectSidebar(): JSX.Element {
<SquarePen size={16} /> <SquarePen size={16} />
</button> </button>
<ProjectCreateModal <ProjectCreateModal
buttonClass="caption bg-gray-100" buttonClass="caption"
onSubmit={handleCreateProject} onSubmit={handleCreateProject}
/> />
</header> </header>

View File

@ -35,7 +35,7 @@ export default function UserProfileForm({ onClose }: { onClose: () => void }) {
<Button <Button
onClick={handleLogout} onClick={handleLogout}
variant="outlinePrimary" variant="blue"
className="mt-4" className="mt-4"
disabled={isLoggingOut} disabled={isLoggingOut}
> >

View File

@ -35,7 +35,7 @@ export default function ImageSelection({ projectId, selectedImages, setSelectedI
<div className="mb-2 flex items-center justify-between"> <div className="mb-2 flex items-center justify-between">
<Label> ( )</Label> <Label> ( )</Label>
<Button <Button
variant="outline" variant="blue"
size="sm" size="sm"
onClick={handleSelectAll} onClick={handleSelectAll}
type="button" type="button"
@ -57,7 +57,7 @@ export default function ImageSelection({ projectId, selectedImages, setSelectedI
<span className="truncate">{image.imageTitle}</span> <span className="truncate">{image.imageTitle}</span>
<div className="flex items-center space-x-2"> <div className="flex items-center space-x-2">
<Button <Button
variant={selectedImages.includes(image.id) ? 'destructive' : 'outline'} variant={selectedImages.includes(image.id) ? 'red' : 'blue'}
size="sm" size="sm"
onClick={() => handleImageSelect(image.id)} onClick={() => handleImageSelect(image.id)}
className="px-3 py-1" className="px-3 py-1"

View File

@ -182,12 +182,7 @@ export default function ImageUploadFileForm({
{isUploading ? ( {isUploading ? (
<Button <Button
onClick={handleClose} onClick={handleClose}
variant="outlinePrimary" variant={isFailed ? 'red' : 'blue'}
className={
isFailed
? 'border-red-500 text-red-500 hover:bg-red-500 dark:border-red-500 dark:text-red-500 dark:hover:bg-red-500'
: ''
}
disabled={!isUploaded && !isFailed} disabled={!isUploaded && !isFailed}
> >
{isFailed ? '업로드 실패 (닫기)' : isUploaded ? '업로드 완료 (닫기)' : `업로드 중... ${progress}%`} {isFailed ? '업로드 실패 (닫기)' : isUploaded ? '업로드 완료 (닫기)' : `업로드 중... ${progress}%`}
@ -195,7 +190,7 @@ export default function ImageUploadFileForm({
) : ( ) : (
<Button <Button
onClick={handleUpload} onClick={handleUpload}
variant="outlinePrimary" variant="blue"
disabled={files.length === 0} disabled={files.length === 0}
> >

View File

@ -166,12 +166,7 @@ export default function ImageUploadFolderFileForm({
{isUploading ? ( {isUploading ? (
<Button <Button
onClick={handleClose} onClick={handleClose}
variant="outlinePrimary" variant={isFailed ? 'red' : 'blue'}
className={
isFailed
? 'border-red-500 text-red-500 hover:bg-red-500 dark:border-red-500 dark:text-red-500 dark:hover:bg-red-500'
: ''
}
disabled={!isUploaded && !isFailed} disabled={!isUploaded && !isFailed}
> >
{isFailed ? '업로드 실패 (닫기)' : isUploaded ? '업로드 완료 (닫기)' : `업로드 중... ${progress}%`} {isFailed ? '업로드 실패 (닫기)' : isUploaded ? '업로드 완료 (닫기)' : `업로드 중... ${progress}%`}
@ -179,7 +174,7 @@ export default function ImageUploadFolderFileForm({
) : ( ) : (
<Button <Button
onClick={handleUpload} onClick={handleUpload}
variant="outlinePrimary" variant="blue"
disabled={files.length === 0} disabled={files.length === 0}
> >

View File

@ -166,12 +166,7 @@ export default function ImageUploadFolderForm({
{isUploading ? ( {isUploading ? (
<Button <Button
onClick={handleClose} onClick={handleClose}
variant="outlinePrimary" variant={isFailed ? 'red' : 'blue'}
className={
isFailed
? 'border-red-500 text-red-500 hover:bg-red-500 dark:border-red-500 dark:text-red-500 dark:hover:bg-red-500'
: ''
}
disabled={!isUploaded && !isFailed} disabled={!isUploaded && !isFailed}
> >
{isFailed ? '업로드 실패 (닫기)' : isUploaded ? '업로드 완료 (닫기)' : `업로드 중... ${progress}%`} {isFailed ? '업로드 실패 (닫기)' : isUploaded ? '업로드 완료 (닫기)' : `업로드 중... ${progress}%`}
@ -179,7 +174,7 @@ export default function ImageUploadFolderForm({
) : ( ) : (
<Button <Button
onClick={handleUpload} onClick={handleUpload}
variant="outlinePrimary" variant="blue"
disabled={files.length === 0} disabled={files.length === 0}
> >

View File

@ -166,12 +166,7 @@ export default function ImageUploadZipForm({
{isUploading ? ( {isUploading ? (
<Button <Button
onClick={handleClose} onClick={handleClose}
variant="outlinePrimary" variant={isFailed ? 'red' : 'blue'}
className={
isFailed
? 'border-red-500 text-red-500 hover:bg-red-500 dark:border-red-500 dark:text-red-500 dark:hover:bg-red-500'
: ''
}
disabled={!isUploaded && !isFailed} disabled={!isUploaded && !isFailed}
> >
{isFailed ? '업로드 실패 (닫기)' : isUploaded ? '업로드 완료 (닫기)' : `업로드 중... ${progress}%`} {isFailed ? '업로드 실패 (닫기)' : isUploaded ? '업로드 완료 (닫기)' : `업로드 중... ${progress}%`}
@ -179,7 +174,7 @@ export default function ImageUploadZipForm({
) : ( ) : (
<Button <Button
onClick={handleUpload} onClick={handleUpload}
variant="outlinePrimary" variant="blue"
disabled={!file} disabled={!file}
> >

View File

@ -132,7 +132,7 @@ export default function MemberAddForm({ onSubmit }: { onSubmit: (data: MemberAdd
<Button <Button
type="submit" type="submit"
variant="outlinePrimary" variant="blue"
disabled={!form.formState.isValid || !form.getValues('memberId')} disabled={!form.formState.isValid || !form.getValues('memberId')}
> >

View File

@ -38,7 +38,7 @@ export default function MemberAddModal({ projectId, buttonClass = '' }: MemberAd
> >
<DialogTrigger asChild> <DialogTrigger asChild>
<Button <Button
variant="outlinePrimary" variant="blue"
className={`${buttonClass}`} className={`${buttonClass}`}
onClick={handleOpen} onClick={handleOpen}
> >

View File

@ -128,7 +128,7 @@ export default function MemberManageForm({ members, onSubmit }: MemberManageForm
</div> </div>
<Button <Button
type="submit" type="submit"
variant="outlinePrimary" variant="blue"
disabled={!form.formState.isValid} disabled={!form.formState.isValid}
> >

View File

@ -127,7 +127,7 @@ export default function TrainingSettings({
/> />
</div> </div>
<Button <Button
variant="outlinePrimary" variant="blue"
size="lg" size="lg"
onClick={handleSubmit} onClick={handleSubmit}
disabled={!selectedModel || isPolling} disabled={!selectedModel || isPolling}
@ -138,7 +138,7 @@ export default function TrainingSettings({
)} )}
{selectedModel?.isTrain && ( {selectedModel?.isTrain && (
<Button <Button
variant="secondary" variant="red"
size="lg" size="lg"
onClick={handleTrainingStop} onClick={handleTrainingStop}
> >

View File

@ -51,7 +51,7 @@ export default function ProjectCreateForm({ onSubmit }: { onSubmit: (data: Proje
<Form {...form}> <Form {...form}>
<form <form
onSubmit={form.handleSubmit(onSubmit)} onSubmit={form.handleSubmit(onSubmit)}
className="flex flex-col gap-5 overflow-x-auto" className="flex w-full flex-col gap-5 overflow-x-auto p-1"
> >
<FormField <FormField
name="projectName" name="projectName"
@ -104,7 +104,7 @@ export default function ProjectCreateForm({ onSubmit }: { onSubmit: (data: Proje
<FormField <FormField
name="categories" name="categories"
render={({ field }) => ( render={({ field }) => (
<> <div className="mb-1 flex w-full flex-col gap-2">
<div className="body-strong"></div> <div className="body-strong"></div>
<div className="flex gap-2"> <div className="flex gap-2">
<FormControl> <FormControl>
@ -114,40 +114,42 @@ export default function ProjectCreateForm({ onSubmit }: { onSubmit: (data: Proje
/> />
</FormControl> </FormControl>
<Button <Button
variant="outline" variant="blue"
onClick={(event) => handleAddCategory(event, field.onChange)} onClick={(event) => handleAddCategory(event, field.onChange)}
> >
</Button> </Button>
</div> </div>
{categories.length > 0 && ( {categories.length > 0 && (
<ul className="body-small box-border flex grow-0 gap-2 overflow-x-auto"> <div className="flex w-full flex-col overflow-x-auto">
{categories.map((category: string, index: number) => ( <div className="flex gap-2 py-1">
<div {categories.map((category: string, index: number) => (
key={index} <div
className="flex items-center gap-1 rounded-full border border-gray-700 px-2 py-1 text-gray-900" key={index}
> className="flex items-center gap-1 rounded-full border-2 border-gray-700 px-2 py-1 text-gray-700"
<span>{category}</span> >
<X <span>{category}</span>
size={16} <X
className="cursor-pointer" size={16}
onClick={() => { className="cursor-pointer"
const newCategories = categories.filter((_, i) => i !== index); onClick={() => {
field.onChange(newCategories); const newCategories = categories.filter((_, i) => i !== index);
setCategories(newCategories); field.onChange(newCategories);
}} setCategories(newCategories);
/> }}
</div> />
))} </div>
</ul> ))}
</div>
</div>
)} )}
<FormMessage /> <FormMessage />
</> </div>
)} )}
/> />
<Button <Button
type="submit" type="submit"
variant="outlinePrimary" variant="blue"
disabled={!form.formState.isValid} disabled={!form.formState.isValid}
> >

View File

@ -22,8 +22,8 @@ export default function ProjectCreateModal({ onSubmit, buttonClass = '' }: Proje
> >
<DialogTrigger asChild> <DialogTrigger asChild>
<Button <Button
variant="outlinePrimary" variant="blue"
className={`${buttonClass}`} className={buttonClass}
size={'xs'} size={'xs'}
onClick={handleOpen} onClick={handleOpen}
> >

View File

@ -115,14 +115,14 @@ export default function ReviewForm({ projects, onSubmit }: ReviewFormProps): JSX
<div className="actions mt-6 flex justify-end space-x-2"> <div className="actions mt-6 flex justify-end space-x-2">
<Button <Button
variant="destructive" variant="red"
type="button" type="button"
onClick={() => navigate(-1)} onClick={() => navigate(-1)}
> >
</Button> </Button>
<Button <Button
variant="default" variant="black"
type="submit" type="submit"
> >

View File

@ -75,7 +75,7 @@ export default function WorkSpaceCreateForm({ onSubmit }: WorkSpaceCreateFormPro
/> />
<Button <Button
type="submit" type="submit"
variant="outlinePrimary" variant="blue"
disabled={!form.formState.isValid} disabled={!form.formState.isValid}
> >

View File

@ -86,7 +86,7 @@ export default function MemberAddForm({ onSubmit }: { onSubmit: (data: MemberAdd
<Button <Button
type="submit" type="submit"
variant="outlinePrimary" variant="blue"
disabled={form.watch('memberId') === 0} disabled={form.watch('memberId') === 0}
> >

View File

@ -38,7 +38,7 @@ export default function WorkspaceMemberAddModal({
> >
<DialogTrigger asChild> <DialogTrigger asChild>
<Button <Button
variant="outlinePrimary" variant="blue"
className={`${buttonClass}`} className={`${buttonClass}`}
onClick={handleOpen} onClick={handleOpen}
> >

View File

@ -70,7 +70,7 @@ export default function ProjectStructure({ project }: { project: Project }) {
<div className="flex"> <div className="flex">
<Button <Button
variant="outlinePrimary" variant="blue"
className="w-full overflow-hidden" className="w-full overflow-hidden"
disabled={requestAutoLabel.isPending} disabled={requestAutoLabel.isPending}
onClick={() => { onClick={() => {

View File

@ -9,18 +9,22 @@ const buttonVariants = cva(
{ {
variants: { variants: {
variant: { variant: {
default: // default:
'bg-gray-900 text-gray-50 hover:bg-gray-900/90 dark:bg-gray-50 dark:text-gray-900 dark:hover:bg-gray-50/90', // 'bg-gray-900 text-gray-50 hover:bg-gray-900/90 dark:bg-gray-50 dark:text-gray-900 dark:hover:bg-gray-50/90',
destructive: // destructive:
'bg-red-500 text-gray-50 hover:bg-red-500/90 dark:bg-red-900 dark:text-gray-50 dark:hover:bg-red-900/90', // 'bg-red-500 text-gray-50 hover:bg-red-500/90 dark:bg-red-900 dark:text-gray-50 dark:hover:bg-red-900/90',
outline: // outline:
'border border-gray-200 bg-white hover:bg-gray-100 hover:text-gray-900 dark:border-gray-800 dark:bg-gray-950 dark:hover:bg-gray-800 dark:hover:text-gray-50', // 'border border-gray-200 bg-white hover:bg-gray-100 hover:text-gray-900 dark:border-gray-800 dark:bg-gray-950 dark:hover:bg-gray-800 dark:hover:text-gray-50',
outlinePrimary: // outlinePrimary:
'border border-primary text-primary hover:bg-primary hover:text-white dark:border-primary dark:text-primary dark:hover:bg-primary dark:hover:text-white disabled:border-gray-200 disabled:bg-white disabled:text-gray-500 disabled:hover:bg-gray-100 disabled:hover:text-gray-300', // 'border border-primary text-primary hover:bg-primary hover:text-white dark:border-primary dark:text-primary dark:hover:bg-primary dark:hover:text-white disabled:border-gray-200 disabled:bg-white disabled:text-gray-500 disabled:hover:bg-gray-100 disabled:hover:text-gray-300',
secondary: // secondary:
'bg-gray-100 text-gray-900 hover:bg-gray-100/80 dark:bg-gray-800 dark:text-gray-50 dark:hover:bg-gray-800/80', // 'bg-gray-100 text-gray-900 hover:bg-gray-100/80 dark:bg-gray-800 dark:text-gray-50 dark:hover:bg-gray-800/80',
ghost: 'hover:bg-gray-100 hover:text-gray-900 dark:hover:bg-gray-800 dark:hover:text-gray-50', // ghost: 'hover:bg-gray-100 hover:text-gray-900 dark:hover:bg-gray-800 dark:hover:text-gray-50',
link: 'text-gray-900 underline-offset-4 hover:underline dark:text-gray-50', // link: 'text-gray-900 underline-offset-4 hover:underline dark:text-gray-50',
black:
'bg-gray-900 text-white hover:bg-gray-900/90 disabled:border disabled:border-gray-200 disabled:bg-white disabled:text-gray-500',
red: 'bg-red-500 text-white hover:bg-red-500/90 disabled:border disabled:border-gray-200 disabled:bg-white disabled:text-gray-500',
blue: 'bg-blue-500 text-white hover:bg-blue-500/90 disabled:border disabled:border-gray-200 disabled:bg-white disabled:text-gray-500',
}, },
size: { size: {
default: 'h-10 px-4 py-2', default: 'h-10 px-4 py-2',
@ -31,7 +35,7 @@ const buttonVariants = cva(
}, },
}, },
defaultVariants: { defaultVariants: {
variant: 'default', variant: 'blue',
size: 'default', size: 'default',
}, },
} }

View File

@ -44,7 +44,7 @@ export default function Home() {
<> <>
<Button <Button
asChild asChild
variant="outlinePrimary" variant="blue"
size="lg" size="lg"
> >
<Link to="/browse"></Link> <Link to="/browse"></Link>

View File

@ -65,7 +65,7 @@ export default function ProjectReviewList() {
to={`/admin/${workspaceId}/reviews/request`} to={`/admin/${workspaceId}/reviews/request`}
className="ml-auto" className="ml-auto"
> >
<Button variant="outlinePrimary"> </Button> <Button variant="blue"> </Button>
</Link> </Link>
</header> </header>
<ReviewList <ReviewList

View File

@ -132,13 +132,13 @@ export default function ReviewDetail(): JSX.Element {
{reviewDetail.reviewStatus !== 'APPROVED' && reviewDetail.reviewStatus !== 'REJECTED' && ( {reviewDetail.reviewStatus !== 'APPROVED' && reviewDetail.reviewStatus !== 'REJECTED' && (
<div className="actions mt-6 flex justify-end space-x-2"> <div className="actions mt-6 flex justify-end space-x-2">
<Button <Button
variant="destructive" variant="red"
onClick={handleReject} onClick={handleReject}
> >
{'거부'} {'거부'}
</Button> </Button>
<Button <Button
variant="default" variant="black"
onClick={handleApprove} onClick={handleApprove}
> >
{'승인'} {'승인'}
@ -148,7 +148,7 @@ export default function ReviewDetail(): JSX.Element {
<div className="mt-6"> <div className="mt-6">
<Link to={`/admin/${workspaceId}/reviews`}> <Link to={`/admin/${workspaceId}/reviews`}>
<Button variant="outlinePrimary"> </Button> <Button variant="blue"> </Button>
</Link> </Link>
</div> </div>
</div> </div>

View File

@ -65,7 +65,7 @@ export default function WorkspaceReviewList() {
to={`/admin/${workspaceId}/reviews/request`} to={`/admin/${workspaceId}/reviews/request`}
className="ml-auto" className="ml-auto"
> >
<Button variant="outlinePrimary"> </Button> <Button variant="blue"> </Button>
</Link> </Link>
</header> </header>