Skip to content
Snippets Groups Projects
Commit 3d0654a4 authored by Planoetscher Daniel (Student Com20)'s avatar Planoetscher Daniel (Student Com20)
Browse files

changes to route and first steps for tasks page

parent 88bf0e66
No related branches found
No related tags found
No related merge requests found
...@@ -16,9 +16,9 @@ export default function App() { ...@@ -16,9 +16,9 @@ export default function App() {
<Router> <Router>
<Suspense fallback={false}> <Suspense fallback={false}>
<Switch> <Switch>
<ProtectedRoute path="/tasks" component={Tasks} /> <ProtectedRoute path="/tasks" component={<Tasks />} />
<ProtectedRoute path="/projects" component={Projects} /> <ProtectedRoute path="/projects" component={<Projects />} />
<ProtectedRoute path="/stats" component={Stats} /> <ProtectedRoute path="/stats" component={<Stats />} />
<LoginRoute path="/login" component={Login} /> <LoginRoute path="/login" component={Login} />
<LoginRoute path="/register" component={Register} /> <LoginRoute path="/register" component={Register} />
<Route path="/" component={Home} /> <Route path="/" component={Home} />
......
import { ComponentType } from 'react';
import { Redirect, Route } from 'react-router-dom'; import { Redirect, Route } from 'react-router-dom';
import { isLoggedIn } from 'adapters/api'; import { isLoggedIn } from 'adapters/api';
import Navigation from 'components/ui/Navigation';
import Header from 'components/ui/Header';
interface Props { interface Props {
path: string, path: string,
exact?: boolean, exact?: boolean,
component: ComponentType<any> component: JSX.Element
} }
export default function ProtectedRoute({ path, exact, component }: Props) { export default function ProtectedRoute({ path, exact, component }: Props) {
console.log(component);
if (isLoggedIn()) { if (isLoggedIn()) {
return ( return (
<Route path={path} exact={exact} component={component} /> <Route path={path} exact={exact} render={() =>
<>
<Header />
<Navigation />
{ component }
</>
} />
); );
} }
return ( return (
......
.site-header {
display: flex;
justify-content: space-between;
img {
padding: 35px;
}
}
\ No newline at end of file
import './header.scss'; import './header.scss';
import hamburger from 'images/svg/hamburger.svg';
import profile from 'images/svg/profile.svg';
export default function Header() { export default function Header() {
return ( return (
<div></div> <header className="site-header">
<img src={hamburger} alt="Navigation"/>
<img src={profile} alt="Profile"/>
</header>
); );
} }
\ No newline at end of file
...@@ -6,7 +6,7 @@ import background from 'images/svg/nav-bg.svg'; ...@@ -6,7 +6,7 @@ import background from 'images/svg/nav-bg.svg';
export default function Navigation() { export default function Navigation() {
return ( return (
<nav> <nav className="site-nav">
<NavLink to="/tasks" activeClassName="active" className="nav-link"> <NavLink to="/tasks" activeClassName="active" className="nav-link">
<span className="icon material-icons-outlined"> <span className="icon material-icons-outlined">
home home
......
.active { @use 'styles/settings.scss'as s;
.icon {
font-family: 'Material Icons'; .site-nav {
position: fixed;
width: 100%;
bottom: 0;
left: 0;
height: 60px;
display: flex;
align-items: center;
justify-content: center;
.background {
position: absolute;
bottom: 0;
left: 0;
max-width: 100%;
height: auto;
z-index: -1;
} }
}
\ No newline at end of file .nav-link {
color: s.$body-color;
position: relative;
padding: 10px 30px;
display: flex;
.icon {
font-size: 24px;
line-height: 1;
}
.label {
position: absolute;
opacity: 0;
font-size: 12px;
top: 50%;
left: 60px;
transform: translateY(-50%);
z-index: -1;
}
&.active {
padding-right: 60px;
.icon {
font-family: 'Material Icons';
}
.label {
opacity: 1;
}
}
}
}
\ No newline at end of file
<svg width="31" height="24" viewBox="0 0 31 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect width="31" height="4" rx="2" fill="#3A5255"/>
<rect y="10" width="24" height="4" rx="2" fill="#3A5255"/>
<rect y="20" width="12" height="4" rx="2" fill="#3A5255"/>
</svg>
<svg width="21" height="25" viewBox="0 0 21 25" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect x="3" width="15" height="15" rx="7.5" fill="#3A5255"/>
<rect y="18" width="21" height="7" rx="3.5" fill="#3A5255"/>
</svg>
...@@ -46,7 +46,7 @@ a { ...@@ -46,7 +46,7 @@ a {
max-width: 1280px; max-width: 1280px;
width: 100%; width: 100%;
margin: 0 auto; margin: 0 auto;
padding: 20px; padding: 30px;
} }
h1, h2, h3, h4, h5, h6 { h1, h2, h3, h4, h5, h6 {
......
import Navigation from 'components/ui/Navigation';
import './tasks.scss'; import './tasks.scss';
export default function Tasks() { export default function Tasks() {
return ( return (
<div className="tasks-page"> <>
<Navigation /> <div className="tasks-page page-container">
<main> <main className="content-container">
<h1>Tasks</h1> <h1>Tasks</h1>
</main> <p>Hey Daniel, you have <strong>10</strong> Tasks for today.</p>
</div> </main>
</div>
</>
); );
} }
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment