-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #31 from ipti/new/registration
New/registration
- Loading branch information
Showing
41 changed files
with
528 additions
and
229 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { ReactNode } from "react"; | ||
import { Container, Padding } from "../../Styles/styles" | ||
|
||
const ContentPage = ({ description, title, children }: { title: string, description: string, children: ReactNode }) => { | ||
return ( | ||
<Container> | ||
<h1>{title}</h1> | ||
<Padding padding="8px" /> | ||
<p>{description}</p> | ||
<Padding padding="8px" /> | ||
{children} | ||
</Container> | ||
) | ||
} | ||
|
||
export default ContentPage; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
import { Form, Formik } from "formik"; | ||
import { Button } from "primereact/button"; | ||
import { useContext } from "react"; | ||
import { useParams } from "react-router-dom"; | ||
import ContentPage from "../../../Components/ContentPage"; | ||
import Loading from "../../../Components/Loading"; | ||
import TextInput from "../../../Components/TextInput"; | ||
import ClassroomProvider, { ClassroomContext } from "../../../Context/Classroom/context"; | ||
import { ClassroomTypes } from "../../../Context/Classroom/type"; | ||
import { getYear } from "../../../Services/localstorage"; | ||
import { Padding, Row } from "../../../Styles/styles"; | ||
|
||
const FormClassroom = () => { | ||
return ( | ||
<ClassroomProvider> | ||
<FormClassroomPage /> | ||
</ClassroomProvider> | ||
) | ||
} | ||
|
||
const FormClassroomPage = () => { | ||
|
||
const { id } = useParams() | ||
|
||
const initialValues = { | ||
name: "" | ||
} | ||
|
||
const props = useContext(ClassroomContext) as ClassroomTypes | ||
|
||
if (props.isLoading) return <Loading />; | ||
|
||
|
||
return ( | ||
<ContentPage title="Criar turma" description="Crie uma nova turma."> | ||
<Padding padding="16px" /> | ||
<Formik initialValues={initialValues} onSubmit={(values) => { props.CreateClassroom({ ...values, project: parseInt(id!), year: parseInt(getYear()!) }) }}> | ||
{({ values, errors, handleChange, touched }) => { | ||
return ( | ||
<Form> | ||
<label>Nome *</label> | ||
<Padding /> | ||
<TextInput name="name" onChange={handleChange} placeholder="Nome *" value={values.name} /> | ||
<Padding /> | ||
{errors.name && touched.name ? ( | ||
<div style={{ color: "red", marginTop: "8px" }}>{errors.name}</div> | ||
) : null} | ||
<Padding padding="16px" /> | ||
<Row id="end"> | ||
<Button label="Criar" /> | ||
</Row> | ||
</Form> | ||
) | ||
}} | ||
</Formik> | ||
|
||
</ContentPage> | ||
) | ||
} | ||
|
||
export default FormClassroom; |
Oops, something went wrong.