File size: 936 Bytes
a417977
1813a37
 
a417977
 
1813a37
 
a417977
1813a37
 
 
a417977
 
1813a37
 
 
 
 
 
 
a417977
1813a37
 
 
 
 
 
 
 
 
1982de5
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import type {ComponentChildren, JSX} from "preact";
import style from "./style.module.scss"
import {Settings} from "preact-feather"
import {routeCtx, routes} from "@/contexts/route";
import {useContext} from "preact/hooks";

export function Layout(props: {
    breadcrumbs: JSX.Element,
    title: string,
    children: ComponentChildren
}) {
    const [,setRoute] = useContext(routeCtx);

    return(
        <div>
            <nav className={style.breadcrumbs}>
                {props.breadcrumbs}
                <div className={style.actions}>
                    <a href="#" title="Paramètres" onClick={e => {
                        e.preventDefault();
                        setRoute(routes.settings());
                    }}>
                        <Settings size={18}/>
                    </a>
                </div>
            </nav>
            <h2>{props.title}</h2>
            {props.children}
        </div>
    )
}