Skip to content

Commit

Permalink
refactor: adjust save button on new project form
Browse files Browse the repository at this point in the history
  • Loading branch information
brunosllz committed Sep 27, 2023
1 parent df3b546 commit db81052
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 10 deletions.
18 changes: 18 additions & 0 deletions src/app/(app)/me/projects/new/components/save-button.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
'use client'

import { useUploadStore } from '@/store'
import { Button } from '@/components/ui/button'

export function SaveButton() {
const uploadStatus = useUploadStore((store) => store.uploadStatus)

return (
<Button
disabled={uploadStatus === 'submitting'}
type="submit"
form="new-project"
>
Save
</Button>
)
}
13 changes: 3 additions & 10 deletions src/app/(app)/me/projects/new/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,13 @@ import { Separator } from '@/components/ui/separator'
import Link from 'next/link'
import { NewProjectForm } from './components/new-project-form'
import { Metadata } from 'next'
import { useUploadStore } from '@/store'
import { SaveButton } from './components/save-button'

export const metadata: Metadata = {
title: 'New Project',
}

export default function NewProject() {
const { uploadStatus } = useUploadStore()

return (
<div>
<div className="flex items-center justify-between">
Expand All @@ -26,13 +24,8 @@ export default function NewProject() {
<Button asChild variant="outline">
<Link href="/me/projects">Cancel</Link>
</Button>
<Button
disabled={uploadStatus === 'submitting'}
type="submit"
form="new-project"
>
Save
</Button>

<SaveButton />
</div>
</div>

Expand Down

0 comments on commit db81052

Please sign in to comment.