Skip to content
Snippets Groups Projects
Commit 9b7a5f05 authored by Guilhem CARRON's avatar Guilhem CARRON
Browse files

Improve layout + logout

parent 2697b941
No related branches found
No related tags found
2 merge requests!7feat: add front office,!2Feat/setup auth
...@@ -25,7 +25,7 @@ function App() { ...@@ -25,7 +25,7 @@ function App() {
return () => { return () => {
subscribed = false subscribed = false
} }
}, [isLogged]) }, [isLogged, setisLogged])
return ( return (
<BrowserRouter> <BrowserRouter>
......
@import '../../styles/config/colors'; @import '../../styles/config/colors';
@import '../../styles/config/typography'; @import '../../styles/config/typography';
@import '../../styles/config/breakpoints';
.date-selector { .date-selector {
display: flex; display: flex;
align-items: center; align-items: center;
...@@ -7,6 +8,10 @@ ...@@ -7,6 +8,10 @@
height: 3rem; height: 3rem;
margin: auto; margin: auto;
max-width: 250px; max-width: 250px;
@media screen and(min-width: $width-desktop) {
position: relative;
left: -2rem;
}
.text { .text {
@include text-large(); @include text-large();
color: white; color: white;
......
...@@ -142,12 +142,12 @@ const Editing: React.FC = () => { ...@@ -142,12 +142,12 @@ const Editing: React.FC = () => {
<p className="title pagetitle"> <p className="title pagetitle">
Édition des informations et de la citation du mois Édition des informations et de la citation du mois
</p> </p>
<DateSelector date={date} setDate={setDate} isEmpty={isEmpty} />
</div> </div>
{isLoading ? ( {isLoading ? (
<Loader /> <Loader />
) : ( ) : (
<div className="content"> <div className="content">
<DateSelector date={date} setDate={setDate} isEmpty={isEmpty} />
<MonthlyNews <MonthlyNews
header={header} header={header}
quote={quote} quote={quote}
......
@import '../../styles/config/typography.scss'; @import '../../styles/config/typography.scss';
@import '../../styles/config/layout.scss';
.header { .header {
position: fixed;
z-index: 1500;
width: inherit;
background: radial-gradient( background: radial-gradient(
74.83% 76.97% at 50% 13.64%, 74.83% 76.97% at 50% 13.64%,
#343641 0%, #343641 0%,
#1b1c22 100% #1b1c22 100%
); );
height: 5rem; height: $navigator-height;
box-shadow: 0px 5px 5px rgb(0 0 0 / 20%), 0px 3px 14px rgb(0 0 0 / 12%), box-shadow: 0px 5px 5px rgb(0 0 0 / 0%), 0px 3px 14px rgb(0 0 0 / 0%),
0px 8px 10px rgb(0 0 0 / 14%); 0px 8px 10px rgb(0 0 0 / 15%);
padding: 1.7rem; padding: 1.7rem;
} }
.content { .content {
padding: 1rem; padding: 1rem;
margin-top: $navigator-height;
} }
.subtitle { .subtitle {
margin: 1rem 0; margin: 1rem 0;
......
...@@ -12,6 +12,8 @@ ...@@ -12,6 +12,8 @@
left: 0; left: 0;
width: $menu-width; width: $menu-width;
height: 100vh; height: 100vh;
z-index: 1501;
@media screen and(max-width: $width-phone) { @media screen and(max-width: $width-phone) {
width: 0; width: 0;
display: none; display: none;
...@@ -23,6 +25,7 @@ ...@@ -23,6 +25,7 @@
left: 0; left: 0;
height: $navbar-height; height: $navbar-height;
width: 100%; width: 100%;
z-index: 1500;
} }
.wrapper { .wrapper {
flex: 1; flex: 1;
......
...@@ -6,8 +6,14 @@ import { NavLink } from 'react-router-dom' ...@@ -6,8 +6,14 @@ import { NavLink } from 'react-router-dom'
import { UserContext } from '../../hooks/userContext' import { UserContext } from '../../hooks/userContext'
const Menu: React.FC = () => { const Menu: React.FC = () => {
const { isLogged, logoutUser } = useContext(UserContext) const { isLogged, logoutUser, setisLogged } = useContext(UserContext)
const handleLogout = () => {
if (logoutUser && setisLogged) {
logoutUser()
setisLogged(false)
}
}
return ( return (
<nav className={'menu'}> <nav className={'menu'}>
<div className="logo-container"> <div className="logo-container">
...@@ -24,7 +30,9 @@ const Menu: React.FC = () => { ...@@ -24,7 +30,9 @@ const Menu: React.FC = () => {
</div> </div>
<div className="administration"> <div className="administration">
{isLogged ? ( {isLogged ? (
<p onClick={logoutUser}>Logout</p> <button className="btnValid logButton" onClick={handleLogout}>
Logout
</button>
) : ( ) : (
<NavLink to="/login" activeClassName="active"> <NavLink to="/login" activeClassName="active">
Login Login
......
...@@ -10,6 +10,9 @@ ...@@ -10,6 +10,9 @@
border-top: unset; border-top: unset;
border-right: unset; border-right: unset;
background-color: $grey-dark; background-color: $grey-dark;
position: relative;
z-index: 1501;
.logo-container { .logo-container {
display: flex; display: flex;
} }
...@@ -35,7 +38,8 @@ ...@@ -35,7 +38,8 @@
.administration { .administration {
margin-top: auto; margin-top: auto;
} }
} .logButton {
.mobileMenu { width: 100px;
margin-left: -$menu-width; min-width: 0;
}
} }
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
position: fixed; position: fixed;
top: 0; top: 0;
width: 100%; width: 100%;
z-index: 999; z-index: 9999;
.modal-container { .modal-container {
align-items: center; align-items: center;
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
align-items: center; align-items: center;
justify-content: center; justify-content: center;
padding: 0 1rem; padding: 0 1rem;
z-index: 1500;
.menu-list { .menu-list {
display: flex; display: flex;
align-items: center; align-items: center;
......
import React, { useState } from 'react' import React, { useContext, useState } from 'react'
import axios from 'axios' import axios from 'axios'
import { User } from '../models/user.model' import { User } from '../models/user.model'
import { UserContext } from './userContext'
const _apiUrl: string = 'https://localhost:1443/' const _apiUrl: string = 'https://localhost:1443/'
...@@ -13,7 +14,7 @@ export interface Auth { ...@@ -13,7 +14,7 @@ export interface Auth {
} }
export const useAuth = (): Auth => { export const useAuth = (): Auth => {
const [error, setError] = useState(null) const [error, setError] = useState(null)
const { setisLogged } = useContext(UserContext)
//login user //login user
const loginUser = async (): Promise<void> => { const loginUser = async (): Promise<void> => {
try { try {
......
$menu-width: 8rem; $menu-width: 8rem;
$navbar-height: 3.5rem; $navbar-height: 3.5rem;
$navigator-height: 8rem;
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