Add slider menu and subpages
This commit is contained in:
parent
db91d91d05
commit
8308049a90
@ -19,5 +19,8 @@
|
|||||||
"prettier-plugin-svelte": "^2.4.0",
|
"prettier-plugin-svelte": "^2.4.0",
|
||||||
"svelte": "^3.44.0"
|
"svelte": "^3.44.0"
|
||||||
},
|
},
|
||||||
"type": "module"
|
"type": "module",
|
||||||
|
"dependencies": {
|
||||||
|
"@sveltejs/adapter-static": "^1.0.0-next.25"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@ -5,6 +5,7 @@
|
|||||||
<meta name="description" content="" />
|
<meta name="description" content="" />
|
||||||
<link rel="icon" href="%svelte.assets%/favicon.png" />
|
<link rel="icon" href="%svelte.assets%/favicon.png" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||||
|
<link href="https://unpkg.com/tailwindcss@^1.0/dist/tailwind.min.css" rel="stylesheet"/>
|
||||||
%svelte.head%
|
%svelte.head%
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|||||||
15
webapp/src/routes/_Main.svelte
Normal file
15
webapp/src/routes/_Main.svelte
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
<main class="p-4 text-gray-300">
|
||||||
|
<svg height="100%" width="100%">
|
||||||
|
<line x1=0 y1=4 x2=400 y2=4/>
|
||||||
|
<line x1=0 y1=34 x2=200 y2=34/>
|
||||||
|
<line x1=0 y1=64 x2=300 y2=64/>
|
||||||
|
<line x1=0 y1=94 x2=280 y2=94/>
|
||||||
|
</svg>
|
||||||
|
</main>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
svg line {
|
||||||
|
stroke: currentColor;
|
||||||
|
stroke-width: 12;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
25
webapp/src/routes/__layout.svelte
Normal file
25
webapp/src/routes/__layout.svelte
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
<script>
|
||||||
|
import Navbar from "./menu/_Navbar.svelte";
|
||||||
|
import Sidebar from "./menu/_Sidebar.svelte";
|
||||||
|
|
||||||
|
let open = false;
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<main class="w-full h-full">
|
||||||
|
<Sidebar bind:open/>
|
||||||
|
<Navbar bind:sidebar={open}/>
|
||||||
|
|
||||||
|
<slot></slot>
|
||||||
|
</main>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
:global(body) {
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (min-width: 640px) {
|
||||||
|
main {
|
||||||
|
max-width: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
6
webapp/src/routes/about.svelte
Normal file
6
webapp/src/routes/about.svelte
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<svelte:head>
|
||||||
|
<title>About</title>
|
||||||
|
</svelte:head>
|
||||||
|
|
||||||
|
<h1>About this site</h1>
|
||||||
|
<p>TODO ...</p>
|
||||||
@ -1,2 +1,12 @@
|
|||||||
|
<script>
|
||||||
|
import Main from "./_Main.svelte";
|
||||||
|
|
||||||
|
export let name = "Test 2";
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<main class="w-full h-full">
|
||||||
<h1>Welcome to SvelteKit</h1>
|
<h1>Welcome to SvelteKit</h1>
|
||||||
<p>Visit <a href="https://kit.svelte.dev">kit.svelte.dev</a> to read the documentation</p>
|
<p>Visit <a href="https://kit.svelte.dev">kit.svelte.dev</a> to read the documentation</p>
|
||||||
|
|
||||||
|
<Main name={name} />
|
||||||
|
</main>
|
||||||
44
webapp/src/routes/menu/_Hamburger.svelte
Normal file
44
webapp/src/routes/menu/_Hamburger.svelte
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
<script>
|
||||||
|
export let open = false
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<button class="text-gray-500 hover:text-gray-700 cursor-pointer mr-4 border-none focus:outline-none" class:open on:click={() => open = !open}>
|
||||||
|
<svg width=32 height=24>
|
||||||
|
<line id="top" x1=0 y1=2 x2=32 y2=2/>
|
||||||
|
<line id="middle" x1=0 y1=12 x2=24 y2=12/>
|
||||||
|
<line id="bottom" x1=0 y1=22 x2=32 y2=22/>
|
||||||
|
</svg>
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
svg {
|
||||||
|
min-height: 24px;
|
||||||
|
transition: transform 0.3s ease-in-out;
|
||||||
|
}
|
||||||
|
|
||||||
|
svg line {
|
||||||
|
stroke: currentColor;
|
||||||
|
stroke-width: 3;
|
||||||
|
transition: transform 0.3s ease-in-out
|
||||||
|
}
|
||||||
|
|
||||||
|
button {
|
||||||
|
z-index: 20;
|
||||||
|
}
|
||||||
|
|
||||||
|
.open svg {
|
||||||
|
transform: scale(0.7)
|
||||||
|
}
|
||||||
|
|
||||||
|
.open #top {
|
||||||
|
transform: translate(6px, 0px) rotate(45deg)
|
||||||
|
}
|
||||||
|
|
||||||
|
.open #middle {
|
||||||
|
opacity: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.open #bottom {
|
||||||
|
transform: translate(-12px, 9px) rotate(-45deg)
|
||||||
|
}
|
||||||
|
</style>
|
||||||
9
webapp/src/routes/menu/_Logo.svelte
Normal file
9
webapp/src/routes/menu/_Logo.svelte
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<svg width=auto height=30>
|
||||||
|
<text x=0 y=20>ACME</text>
|
||||||
|
</svg>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
text {
|
||||||
|
fill: currentColor
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
After Width: | Height: | Size: 111 B |
4
webapp/src/routes/menu/_Menu.svelte
Normal file
4
webapp/src/routes/menu/_Menu.svelte
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
<nav class="hidden text-gray-500 uppercase text-bold sm:block">
|
||||||
|
<a href="/" class="hover:text-gray-700 hover:no-underline">Home</a>
|
||||||
|
<a href="/about" class="hover:text-gray-700 hover:no-underline">About</a>
|
||||||
|
</nav>
|
||||||
16
webapp/src/routes/menu/_Navbar.svelte
Normal file
16
webapp/src/routes/menu/_Navbar.svelte
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
<script>
|
||||||
|
import Logo from './_Logo.svelte';
|
||||||
|
import Hamburger from './_Hamburger.svelte';
|
||||||
|
import Menu from './_Menu.svelte';
|
||||||
|
|
||||||
|
export let sidebar = false;
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<header class="flex justify-between bg-gray-200 p-2 items-center text-gray-600 border-b-2">
|
||||||
|
<nav class="flex">
|
||||||
|
<Hamburger bind:open={sidebar}/>
|
||||||
|
<Logo/>
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
<Menu/>
|
||||||
|
</header>
|
||||||
21
webapp/src/routes/menu/_Sidebar.svelte
Normal file
21
webapp/src/routes/menu/_Sidebar.svelte
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
<script>
|
||||||
|
export let open = false
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<aside class="absolute w-full h-full bg-gray-200 border-r-2 shadow-lg" class:open>
|
||||||
|
<nav class="p-12 text-xl">
|
||||||
|
<a class="block" href="/">Home</a>
|
||||||
|
<a class="block" href="/about">About</a>
|
||||||
|
</nav>
|
||||||
|
</aside>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
aside {
|
||||||
|
left: -100%;
|
||||||
|
transition: left 0.3s ease-in-out
|
||||||
|
}
|
||||||
|
|
||||||
|
.open {
|
||||||
|
left: 0
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@ -1,4 +1,4 @@
|
|||||||
import adapter from '@sveltejs/adapter-auto';
|
import adapter from '@sveltejs/adapter-static';
|
||||||
|
|
||||||
/** @type {import('@sveltejs/kit').Config} */
|
/** @type {import('@sveltejs/kit').Config} */
|
||||||
const config = {
|
const config = {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user