main
|
Last change
on this file since 0d447f6 was 8ee4553, checked in by Bati <no-reply@…>, 7 months ago |
|
scaffold Vike app with Bati
|
-
Property mode
set to
100644
|
|
File size:
1.4 KB
|
| Rev | Line | |
|---|
| [8ee4553] | 1 | import "./Layout.css";
|
|---|
| 2 |
|
|---|
| 3 | import logoUrl from "../assets/logo.svg";
|
|---|
| 4 | import { Link } from "../components/Link";
|
|---|
| 5 |
|
|---|
| 6 | export default function Layout({ children }: { children: React.ReactNode }) {
|
|---|
| 7 | return (
|
|---|
| 8 | <div
|
|---|
| 9 | style={{
|
|---|
| 10 | display: "flex",
|
|---|
| 11 | maxWidth: 900,
|
|---|
| 12 | margin: "auto",
|
|---|
| 13 | }}
|
|---|
| 14 | >
|
|---|
| 15 | <Sidebar>
|
|---|
| 16 | <Logo />
|
|---|
| 17 | <Link href="/">Welcome</Link>
|
|---|
| 18 | <Link href="/todo">Todo</Link>
|
|---|
| 19 | <Link href="/star-wars">Data Fetching</Link>
|
|---|
| 20 | </Sidebar>
|
|---|
| 21 | <Content>{children}</Content>
|
|---|
| 22 | </div>
|
|---|
| 23 | );
|
|---|
| 24 | }
|
|---|
| 25 |
|
|---|
| 26 | function Sidebar({ children }: { children: React.ReactNode }) {
|
|---|
| 27 | return (
|
|---|
| 28 | <div
|
|---|
| 29 | id="sidebar"
|
|---|
| 30 | style={{
|
|---|
| 31 | padding: 20,
|
|---|
| 32 | flexShrink: 0,
|
|---|
| 33 | display: "flex",
|
|---|
| 34 | flexDirection: "column",
|
|---|
| 35 | lineHeight: "1.8em",
|
|---|
| 36 | borderRight: "2px solid #eee",
|
|---|
| 37 | }}
|
|---|
| 38 | >
|
|---|
| 39 | {children}
|
|---|
| 40 | </div>
|
|---|
| 41 | );
|
|---|
| 42 | }
|
|---|
| 43 |
|
|---|
| 44 | function Content({ children }: { children: React.ReactNode }) {
|
|---|
| 45 | return (
|
|---|
| 46 | <div id="page-container">
|
|---|
| 47 | <div
|
|---|
| 48 | id="page-content"
|
|---|
| 49 | style={{
|
|---|
| 50 | padding: 20,
|
|---|
| 51 | paddingBottom: 50,
|
|---|
| 52 | minHeight: "100vh",
|
|---|
| 53 | }}
|
|---|
| 54 | >
|
|---|
| 55 | {children}
|
|---|
| 56 | </div>
|
|---|
| 57 | </div>
|
|---|
| 58 | );
|
|---|
| 59 | }
|
|---|
| 60 |
|
|---|
| 61 | function Logo() {
|
|---|
| 62 | return (
|
|---|
| 63 | <div
|
|---|
| 64 | style={{
|
|---|
| 65 | marginTop: 20,
|
|---|
| 66 | marginBottom: 10,
|
|---|
| 67 | }}
|
|---|
| 68 | >
|
|---|
| 69 | <a href="/">
|
|---|
| 70 | <img src={logoUrl} height={64} width={64} alt="logo" />
|
|---|
| 71 | </a>
|
|---|
| 72 | </div>
|
|---|
| 73 | );
|
|---|
| 74 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.