Skip to content

Commit

Permalink
#14 Add boilerplate and route to create post
Browse files Browse the repository at this point in the history
  • Loading branch information
SandraBergstrom committed Jun 22, 2023
1 parent b36afc5 commit 4a94dba
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { Route, Switch } from "react-router-dom";
import "./api/axiosDefaults";
import SignUpForm from "./pages/auth/SignUpForm";
import LoginForm from "./pages/auth/LoginForm";
import PostCreateForm from "./pages/posts/PostCreateForm";

function App() {
return (
Expand All @@ -15,6 +16,7 @@ function App() {
<Route exact path="/" render={() => <h1>Home Page</h1>} />
<Route exact path="/login" render={() => <LoginForm />} />
<Route exact path="/signup" render={() => <SignUpForm />} />
<Route exact path="/posts/create" render={() => <PostCreateForm />} />
<Route render={() => <p>Page not found!</p>} />
</Switch>
</Container>
Expand Down
60 changes: 60 additions & 0 deletions src/pages/posts/PostCreateForm.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
import React, { useState } from "react";

import Form from "react-bootstrap/Form";
import Button from "react-bootstrap/Button";
import Row from "react-bootstrap/Row";
import Col from "react-bootstrap/Col";
import Container from "react-bootstrap/Container";

import Upload from "../../assets/upload.png";

import styles from "../../styles/PostCreateEditForm.module.css";
import appStyles from "../../App.module.css";
import btnStyles from "../../styles/Button.module.css";

function PostCreateForm() {
const [errors, setErrors] = useState({});

const textFields = (
<div className="text-center">
{/* Add your form fields here */}

<Button
className={`${btnStyles.Button} ${btnStyles.Blue}`}
onClick={() => {}}
>
cancel
</Button>
<Button className={`${btnStyles.Button} ${btnStyles.Blue}`} type="submit">
create
</Button>
</div>
);

return (
<Form>
<Row>
<Col className="py-2 p-0 p-md-2" md={7} lg={8}>
<Container
className={`${appStyles.Content} ${styles.Container} d-flex flex-column justify-content-center`}
>
<Form.Group className="text-center">
<Form.Label
className="d-flex justify-content-center"
htmlFor="image-upload"
>
ASSET
</Form.Label>
</Form.Group>
<div className="d-md-none">{textFields}</div>
</Container>
</Col>
<Col md={5} lg={4} className="d-none d-md-block p-0 p-md-2">
<Container className={appStyles.Content}>{textFields}</Container>
</Col>
</Row>
</Form>
);
}

export default PostCreateForm;

0 comments on commit 4a94dba

Please sign in to comment.