Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 6a250c18

Přidáno uživatelem Lukáš Vlček před asi 2 roky(ů)

Layout and minor color changes

Zobrazit rozdíly:

webapp/layouts/MainLayout.tsx
1 1
import 'antd/dist/antd.css';
2 2
import styles from '/styles/MainLayout.module.scss';
3
import { useContext } from 'react';
4
import { LoggedUserContext } from '../contexts/LoggedUserContext';
5
import AdminNavBar from '../components/navigation/AdminNavBar';
6
import UserNavBar from '../components/navigation/UserNavBar';
3
import Navbar from './Navbar';
7 4

  
8 5
/**
9 6
 * Creates layout of main screens.
......
11 8
 * @returns The login screen.
12 9
 */
13 10
export function MainLayout(props: { children: React.ReactNode }) {
14
    const { role } = useContext(LoggedUserContext);
15
    const isAdmin = role === 'ADMINISTRATOR';
16
    const isAnnotator = role === 'ANNOTATOR';
17

  
18 11
    return (
19 12
        <div className={styles.layoutWrapper}>
20
            <div className={styles.header}>
21
                {(isAdmin && <AdminNavBar />) || (isAnnotator && <UserNavBar />)}
22
            </div>
13
            <Navbar />
23 14
            <main className={styles.content}>{props.children}</main>
24
            <div className={styles.footer} />
25 15
        </div>
26 16
    );
27 17
}
18

  
19
export default MainLayout;

Také k dispozici: Unified diff