Skip to content

Commit

Permalink
Note Form
Browse files Browse the repository at this point in the history
  • Loading branch information
AbdelrahmanElalfee committed Aug 17, 2024
1 parent f426f3d commit 3cb31ad
Show file tree
Hide file tree
Showing 12 changed files with 135 additions and 33 deletions.
14 changes: 7 additions & 7 deletions frontend/src/App.jsx
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
import { Routes, Route } from 'react-router-dom'
import MainPage from './pages/MainPage'
import NoteList from './components/NoteList'
import NoteList from './pages/NoteList'
import Form from './components/Form'
import Auth from './pages/Auth'
import NoteForm from './pages/NoteForm'

function App() {

return (
<Routes>
<Route path="/" element={<MainPage />}>
<Route path="" element={<NoteList />}/>
<Route path="create" element={<h1>Create</h1>} />
<Route path="update" element={<h1>Update</h1>} />
<Route path="create" element={<NoteForm />}/>
<Route path="details/:id" element={<h1>Update</h1>}/>
</Route>
<Route path="/" element={<Auth />}>
<Route path="register" element={<Form type={'register'}/>}/>
<Route path="login" element={<Form type={'login'}/>} />
<Route path="register" element={<Form type={'register'} />}/>
<Route path="login" element={<Form type={'login'} />}/>
</Route>
<Route path="*" element={<h1>Not Found</h1>} />
<Route path="*" element={<h1>Not Found</h1>}/>
</Routes>
)
}
Expand Down
12 changes: 9 additions & 3 deletions frontend/src/components/Button.jsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
import '../styles/Button.css';
import add from '../assets/add.png';
import PropTypes from 'prop-types';

const Button = () => {
const Button = ({type, onClick}) => {
return (
<button className='btn'>
<button className='btn' onClick={onClick}>
<img src={add} alt='icon' />
<p>Add note</p>
<p>{type} note</p>
</button>
)
}

Button.propTypes = {
type: PropTypes.string.isRequired,
onClick: PropTypes.func.isRequired
}

export default Button;
2 changes: 1 addition & 1 deletion frontend/src/components/Form.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const Form = ({ type, handleForm }) => {
<Input type="text" placeholder="Username" name='username' />
<Input type="password" placeholder="Password" name='password' />
<div className="form-footer">
<button type="submit" onClick={handleForm}>{type === 'login' ? 'Login' : 'Register'}</button>
<button onClick={handleForm}>{type === 'login' ? 'Login' : 'Register'}</button>
</div>
</form>
</div>
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/components/Navbar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const Navbar = () => {
<div className="navbar-container">
<div className="navbar-search">
<img src={search} alt="search" />
<input type="text" placeholder="Search" />
<input type="search" placeholder="Search" />
</div>
<div className="navbar-profile">
<img src={profile} alt="profile" />
Expand All @@ -16,4 +16,4 @@ const Navbar = () => {
)
}

export default Navbar;
export default Navbar;
12 changes: 12 additions & 0 deletions frontend/src/components/TextArea.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import '../styles/TextArea.css'

const TextArea = () => {
return (
<div className='textarea-container'>
<label>Take a note...</label>
<textarea rows='20' name='content'/>
</div>
)
}

export default TextArea
26 changes: 26 additions & 0 deletions frontend/src/pages/NoteForm.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import Button from '../components/Button'
import Input from '../components/Input';
import TextArea from '../components/TextArea';
import '../styles/NoteForm.css';

const NoteForm = () => {

const onClick = (e) => {
e.preventDefault();
console.log('Add note button clicked');
}

return (
<div className="note-form-container">
<form className="note-form">
<Input type="text" placeholder="Title" name='title'/>
<TextArea />
<div className='note-form-footer'>
<Button type='Add' onClick={onClick}/>
</div>
</form>
</div>
)
}

export default NoteForm
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import NoteCard from './NoteCard'
import NoteCard from '../components/NoteCard'
import '../styles/NoteList.css'

export default function NoteList() {
Expand Down
19 changes: 19 additions & 0 deletions frontend/src/styles/Form.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
.form-container {
width: 100%;
}

.form-footer {
display: flex;
justify-content: center;
align-items: center;
align-content: center;
margin: 10px;
}

.form-footer button {
padding: 10px 20px;
border-radius: 10px;
border: none;
outline: none;
color: #0d1b2a;
cursor: pointer;
background-color: #ffbe0b;
box-shadow: rgba(0, 0, 0, 0.24) 0px 3px 8px;
}
19 changes: 0 additions & 19 deletions frontend/src/styles/Input.css
Original file line number Diff line number Diff line change
Expand Up @@ -27,22 +27,3 @@
margin-bottom: 5px;
color: #0d1b2a;
}

.form-footer {
display: flex;
justify-content: center;
align-items: center;
align-content: center;
margin: 10px;
}

.form-footer button {
padding: 10px 20px;
border-radius: 10px;
border: none;
outline: none;
color: #0d1b2a;
cursor: pointer;
background-color: #ffbe0b;
box-shadow: rgba(0, 0, 0, 0.24) 0px 3px 8px;
}
11 changes: 11 additions & 0 deletions frontend/src/styles/NoteForm.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
.note-form-container {
width: 100%;
}

.note-form-footer {
display: flex;
justify-content: start;
align-items: center;
align-content: center;
margin: 10px;
}
29 changes: 29 additions & 0 deletions frontend/src/styles/TextArea.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
.textarea-container {
width: 100%;
padding: 5px;
margin: 15px;
display: flex;
flex-direction: column;
justify-content: start;
align-items: start;
align-content: center;
border-radius: 4px;
}

.textarea-container textarea {
width: 80%;
padding: 10px;
border: 1px solid #e0e1dd;
border-radius: 4px;
outline: none;
background-color: #f8f9fa;
}

.textarea-container textarea:focus {
border: 1px solid #0d1b2a;
}

.textarea-container label {
margin-bottom: 5px;
color: #0d1b2a;
}
18 changes: 18 additions & 0 deletions frontend/src/styles/base.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,24 @@
@import url('https://fonts.googleapis.com/css2?family=Kalam:wght@300;400;700&display=swap');

body {
margin: 0;
padding: 0;
box-sizing: border-box;
background-color: #e0e1dd;
font-family: 'Kalam', cursive;
font-size: 18px;
}

input[type="search"] {
font-size: 16px;
}

input, button {
font-family: 'Kalam', cursive;
font-size: 18px;
}

textarea {
font-family: 'Kalam', cursive;
font-size: 18px;
}

0 comments on commit 3cb31ad

Please sign in to comment.