Create project add & edit pages

This commit is contained in:
Max Wofford 2024-08-16 13:06:21 -04:00
parent 6b8ec22f35
commit 5a869887d1
2 changed files with 78 additions and 0 deletions

View file

@ -0,0 +1,66 @@
import { Input, Label, Text } from 'theme-ui'
import ProjectView from './project-view'
import useForm from '../../../lib/use-form'
const ProjectEditView = ({ project }) => {
const { status, formProps, useField } = useForm(
'/api/arcade/showcase/projects/edit',
null,
{
method: 'PATCH',
initData: { ...project }
}
)
return (
<div>
<form {...formProps}>
<Label>
<Text>Project name</Text>
<Input
{...useField('title')}
placeholder="Arcade"
required
sx={{ border: '1px solid', borderColor: 'muted', mb: 2 }}
/>
</Label>
<Label>
<Text>Repo Link</Text>
<Input
{...useField('repoLink')}
placeholder="https://github.com/hackclub/arcade"
required
sx={{ border: '1px solid', borderColor: 'muted', mb: 2 }}
/>
</Label>
<Label>
<Text>Play Link</Text>
<Input
{...useField('playLink')}
placeholder="https://hackclub.com/arcade"
required
sx={{ border: '1px solid', borderColor: 'muted', mb: 2 }}
/>
</Label>
<Label>
<Text>Screenshot</Text>
<Input
{...useField('screenshot')}
required
sx={{ border: '1px solid', borderColor: 'muted', mb: 2 }}
/>
</Label>
<Label>
<Text>Video</Text>
<Input
{...useField('video')}
required
sx={{ border: '1px solid', borderColor: 'muted', mb: 2 }}
/>
</Label>
</form>
<ProjectView project={project} />
</div>
)
}
export default ProjectEditView

View file

@ -0,0 +1,12 @@
import ProjectEditView from '../../../components/arcade/showcase/project-edit'
const AddProjectPage = () => {
return (
<section>
<h1>Add a project</h1>
<ProjectEditView />
</section>
)
}
export default AddProjectPage