-
Notifications
You must be signed in to change notification settings - Fork 0
MGC-JUL-24 | Syed Arslan Haider| React-Router|WEEK3 #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,80 @@ | ||
| /* Main Container for Layout */ | ||
| .container { | ||
| display: flex; | ||
| height: 100vh; | ||
| /* Full height of the viewport */ | ||
| } | ||
|
|
||
| /* Sidebar Styles */ | ||
| .sidebar { | ||
| width: 300px; | ||
| /* Set sidebar width */ | ||
| background-color: #f4f4f4; | ||
| /* Background color for the sidebar */ | ||
| display: flex; | ||
| flex-direction: column; | ||
| /* Stack the logo and links vertically */ | ||
| align-items: center; | ||
| /* Center the items horizontally */ | ||
| padding: 20px; | ||
| gap: 20px; | ||
| /* Space between the items */ | ||
| } | ||
|
|
||
| /* Logo Styles */ | ||
| .logo { | ||
| margin-top: 30px; | ||
| width: 146px; | ||
| /* Set width of the logo */ | ||
| height: 63px; | ||
| /* Set height of the logo */ | ||
| } | ||
|
|
||
| /* Nav links container */ | ||
| .nav-links { | ||
| margin-top: 40px; | ||
| list-style: none; | ||
| /* Remove default list styling */ | ||
| padding: 0; | ||
| /* Remove padding */ | ||
| display: flex; | ||
| /* Use flexbox to align items */ | ||
| flex-direction: column; | ||
| /* Stack links vertically */ | ||
| gap: 25px; | ||
| /* Add space between the links */ | ||
| align-items: center; | ||
| /* Center links horizontally */ | ||
| } | ||
|
|
||
| /* Link styles */ | ||
| .nav-links a { | ||
| text-decoration: none; | ||
| /* Remove underline from links */ | ||
| color: black; | ||
| /* Set text color */ | ||
| font-weight: bold; | ||
| /* Make text bold */ | ||
| font-size: 18px; | ||
| /* Set font size */ | ||
| padding: 5px 10px; | ||
| /* Add padding to links */ | ||
| transition: background-color 0.3s ease; | ||
| /* Add smooth transition effect */ | ||
| } | ||
|
|
||
| /* Link hover effect */ | ||
| .nav-links a:hover { | ||
| background-color: #ddd; | ||
| /* Light background color on hover */ | ||
| border-radius: 5px; | ||
| /* Rounded corners */ | ||
| } | ||
|
|
||
| /* Content Area */ | ||
| .content { | ||
| flex-grow: 1; | ||
| /* Make content area take up remaining space */ | ||
| padding: 20px; | ||
| /* Add padding to content */ | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,62 +1,28 @@ | ||
| import { useState } from 'react'; | ||
| import { TaskList } from './components/domains/task/TaskList/TaskList'; | ||
| import { NewTaskForm } from './components/domains/task/TaskItem/NewFormTask'; | ||
| import { Link, Outlet } from 'react-router'; | ||
| import './App.css'; | ||
| import logo from './logo.svg'; | ||
|
|
||
| function App() { | ||
| const [taskList, setTaskList] = useState([ | ||
| { | ||
| id: 1, | ||
| title: 'Re-work UI/UX', | ||
| priority: 'low', | ||
| dueDate: '12/04/2021', | ||
| members: ['Said', 'Rechal'], | ||
| description: 'Timmer App', | ||
| }, | ||
| { | ||
| id: 2, | ||
| title: 'Dark Mode Toggle', | ||
| priority: 'low', | ||
| dueDate: '12/05/2025', | ||
| members: ['Umair', 'Precious'], | ||
| description: 'Asa Dark Mode Feature', | ||
| }, | ||
| { | ||
| id: 3, | ||
| title: 'Assessibility Checks', | ||
| priority: 'high', | ||
| dueDate: '11/03/2025', | ||
| members: ['Ebtesam', 'Deborah'], | ||
| description: 'Timer App', | ||
| }, | ||
| { | ||
| id: 4, | ||
| title: 'Notification Checks', | ||
| priority: 'medium', | ||
| dueDate: '15/04/2025', | ||
| members: ['Michel', 'Ricardo'], | ||
| description: 'Timer App', | ||
| }, | ||
| ]); | ||
| const newTask = (taskName, projectName, event) => { | ||
| event.preventDefault(); | ||
| setTaskList((prevTaskInfo) => [ | ||
| ...prevTaskInfo, | ||
| { | ||
| id: `${prevTaskInfo.length + 1}`, | ||
| title: taskName, | ||
| priority: 'High', | ||
| dueDate: '11/03/2025', | ||
| members: ['Syed', 'Said'], | ||
| description: projectName, | ||
| }, | ||
| ]); | ||
| }; | ||
| return ( | ||
| <> | ||
| <TaskList tasks={taskList} /> | ||
| <NewTaskForm handelButton={newTask} /> | ||
| </> | ||
| <div className="container"> | ||
| {/* Sidebar */} | ||
| <div className="sidebar"> | ||
| <img src={logo} alt="Logo" className="logo" /> | ||
| <ul className="nav-links"> | ||
| <li> | ||
| <Link to="/task-manager">Task Manager</Link> | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The implementation is good and works as expected. But the library has a specific NavLink component with more advanced features. 📄 If you are keen to learn more about these advanced features, you can consult the React Router documentation: https://reactrouter.com/start/library/navigating#navlink |
||
| </li> | ||
| <li> | ||
| <Link to="/add-task">Add to Task</Link> | ||
| </li> | ||
| </ul> | ||
| </div> | ||
|
|
||
| {/* Content Area */} | ||
| <div className="content"> | ||
| <Outlet /> | ||
| </div> | ||
| </div> | ||
| ); | ||
| } | ||
|
|
||
| export default App; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,52 +1,90 @@ | ||
| /* General Styling for the Task Item */ | ||
| .itemWrapper { | ||
| position: relative; | ||
| width: 1100px; | ||
| /* Adjusted width */ | ||
| height: 62px; | ||
| /* Adjusted height */ | ||
| background: #E0E4EA; | ||
| /* Background color */ | ||
| border: 1px solid #000000; | ||
| /* Border color */ | ||
| border-radius: 17px; | ||
| /* Border radius to match the design */ | ||
| display: flex; | ||
| justify-content: space-between; | ||
| align-items: center; | ||
| padding: 10px; | ||
| margin-bottom: 10px; | ||
| border-radius: 5px; | ||
| font-size: 16px; | ||
| font-weight: 500; | ||
| color: rgb(12, 12, 12); | ||
| box-sizing: border-box; | ||
| /* Ensures padding doesn't affect width/height */ | ||
| } | ||
|
|
||
| /* Styling for the Title */ | ||
| .itemWrapper h3 { | ||
| margin: 0; | ||
| font-size: 18px; | ||
| font-weight: 600; | ||
| /* Adjusted weight for consistency */ | ||
| color: #000; | ||
| /* Default color for the title */ | ||
| } | ||
|
|
||
| /* Styling for the Paragraphs */ | ||
| .itemWrapper p { | ||
| margin: 0 15px; | ||
| font-size: 14px; | ||
| /* Adjusted font size */ | ||
| color: #333; | ||
| /* Slightly lighter color */ | ||
| } | ||
|
|
||
| /* Background Colors Based on Priority */ | ||
| /* Priority Styling */ | ||
| .priority { | ||
| font-weight: bold; | ||
| padding: 3px 8px; | ||
| border-radius: 5px; | ||
|
|
||
| } | ||
|
|
||
| /* Colors for priority text */ | ||
| /* Priority Colors */ | ||
| .low { | ||
| background-color: lightgreen; | ||
| color: green; | ||
| } | ||
|
|
||
| .medium { | ||
| color: orange; | ||
| background-color: rgb(233, 184, 94); | ||
| color: rgb(255, 165, 0); | ||
| } | ||
|
|
||
| .high { | ||
| background-color: lightcoral; | ||
| color: red; | ||
| } | ||
|
|
||
| /* Information Wrapper for Icons and Text */ | ||
| .infoWrapper { | ||
| display: flex; | ||
| align-items: center; | ||
| gap: 5px; | ||
| /* Space between icon and text */ | ||
| } | ||
|
|
||
| /* Icon Styling */ | ||
| .icon { | ||
| width: 16px; | ||
| height: 16px; | ||
| } | ||
|
|
||
| /* Styling for the Members Section */ | ||
| .membersWrapper { | ||
| display: flex; | ||
| align-items: center; | ||
| gap: 5px; | ||
| } | ||
|
|
||
| /* Adjusted spacing for icons and text in members */ | ||
| .membersWrapper p { | ||
| margin: 0; | ||
| font-size: 14px; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| import { TaskList } from '../components/domains/task/TaskList/TaskList'; | ||
| import { useState } from 'react'; | ||
| //import { NewFormTask } from '../components/domains/task/TaskItem/NewFormTask'; | ||
| export const TaskManager = () => { | ||
| const [taskList, setTaskList] = useState([ | ||
| { | ||
| id: 1, | ||
| title: 'Re-work UI/UX', | ||
| priority: 'low', | ||
| dueDate: '12/04/2021', | ||
| members: ['Said', 'Rechal'], | ||
| description: 'Timmer App', | ||
| }, | ||
| { | ||
| id: 2, | ||
| title: 'Dark Mode Toggle', | ||
| priority: 'low', | ||
| dueDate: '12/05/2025', | ||
| members: ['Umair', 'Precious'], | ||
| description: 'Asa Dark Mode Feature', | ||
| }, | ||
| { | ||
| id: 3, | ||
| title: 'Assessibility Checks', | ||
| priority: 'high', | ||
| dueDate: '11/03/2025', | ||
| members: ['Ebtesam', 'Deborah'], | ||
| description: 'Timer App', | ||
| }, | ||
| { | ||
| id: 4, | ||
| title: 'Notification Checks', | ||
| priority: 'medium', | ||
| dueDate: '15/04/2025', | ||
| members: ['Michel', 'Ricardo'], | ||
| description: 'Timer App', | ||
| }, | ||
| ]); | ||
| const newTask = (taskName, projectName, event) => { | ||
| event.preventDefault(); | ||
| setTaskList((prevTaskInfo) => [ | ||
| ...prevTaskInfo, | ||
| { | ||
| id: `${prevTaskInfo.length + 1}`, | ||
| title: taskName, | ||
| priority: 'High', | ||
| dueDate: '11/03/2025', | ||
| members: ['Syed', 'Said'], | ||
| description: projectName, | ||
| }, | ||
| ]); | ||
| }; | ||
| return ( | ||
| <div> | ||
| <TaskList tasks={taskList} /> | ||
| </div> | ||
| ); | ||
| }; |
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This component is a Layout now. The implementation is alright!
But could be nice trying to follow the conventions and relocate this file to the
pagesfolder.The recommendation from React Router library is set a name with an underscore sign in the begging of the file name of the layout component. Also recommend using a specific naming for the different page component files.
An example of can we name our pages directory is the following:
📄 You can find more information about React Router convention in the official documentation: https://reactrouter.com/how-to/file-route-conventions#nested-layouts-without-nested-urls