mirror of
https://github.com/System-End/site.git
synced 2026-04-20 00:25:19 +00:00
Create project add & edit pages
This commit is contained in:
parent
6b8ec22f35
commit
5a869887d1
2 changed files with 78 additions and 0 deletions
66
components/arcade/showcase/project-edit.js
Normal file
66
components/arcade/showcase/project-edit.js
Normal 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
|
||||
12
pages/arcade/showcase/add.js
Normal file
12
pages/arcade/showcase/add.js
Normal 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
|
||||
Loading…
Add table
Reference in a new issue