Projekt

Obecné

Profil

Stáhnout (989 Bajtů) Statistiky
| Větev: | Tag: | Revize:
1 6d10fe14 Dominik Poch
import 'antd/dist/antd.css';
2 c73aecde Dominik Poch
import styles from '/styles/MainLayout.module.scss';
3 8c45ccb0 hrubyjar
import { useContext } from 'react';
4
import { LoggedUserContext } from '../contexts/LoggedUserContext';
5
import AdminNavBar from '../components/navigation/AdminNavBar';
6
import UserNavBar from '../components/navigation/UserNavBar';
7 6d10fe14 Dominik Poch
8
/**
9
 * Creates layout of main screens.
10
 * @param props Html structure of a login form.
11
 * @returns The login screen.
12
 */
13 c73aecde Dominik Poch
export function MainLayout(props: { children: React.ReactNode }) {
14 8c45ccb0 hrubyjar
    const { role } = useContext(LoggedUserContext);
15
    const isAdmin = role === 'ADMINISTRATOR';
16
    const isAnnotator = role === 'ANNOTATOR';
17
18 6d10fe14 Dominik Poch
    return (
19 c73aecde Dominik Poch
        <div className={styles.layoutWrapper}>
20 ce63b2ab Dominik Poch
            <div className={styles.header}>
21 8c45ccb0 hrubyjar
                {(isAdmin && <AdminNavBar />) || (isAnnotator && <UserNavBar />)}
22 ce63b2ab Dominik Poch
            </div>
23
            <main className={styles.content}>{props.children}</main>
24 8c45ccb0 hrubyjar
            <div className={styles.footer} />
25 ce63b2ab Dominik Poch
        </div>
26 6d10fe14 Dominik Poch
    );
27
}