21 Commits

Author SHA1 Message Date
Filip Krumpe 2c87b8dde1 Move to new Svelte release 2024-05-28 21:02:27 +02:00
Filip Krumpe e65f5955dd Basic styling 2022-01-22 15:56:59 +01:00
Filip Krumpe fa6c94153f Merge branch 'ft_menu' of https://git.filipkrumpe.de/filip/svelte_flask_template into ft_menu 2022-01-17 17:14:31 +01:00
Filip Krumpe 31a9d21b71 Remove z-index bug 2022-01-17 17:10:49 +01:00
Filip Krumpe c3b6c4c547 add the current packages in package-lock 2022-01-17 17:10:37 +01:00
Filip Krumpe b65f4b91f2 correctly ignore the build files 2022-01-17 17:10:14 +01:00
Filip Krumpe 8301f34a91 use npm ci instead of install
to make sure the packages are installed as stated in the package-lock.json file
2022-01-13 07:30:47 +01:00
Filip Krumpe bfc0f5e872 ignore temporary build files but add the package lock 2022-01-13 07:27:20 +01:00
Filip Krumpe aab713de3a Add thanks for the work done by others 2022-01-13 07:13:10 +01:00
Filip Krumpe 3d01f06936 fix wrong width of auto 2022-01-12 16:22:55 +01:00
Filip Krumpe 5b26406011 Remove unused 2022-01-12 16:22:37 +01:00
Filip Krumpe 6eb95435ce Fix broken tailwind import 2022-01-12 16:14:49 +01:00
Filip Krumpe eaf6d18bc7 Add tailwind css to the setup 2022-01-12 15:06:44 +01:00
Filip Krumpe d86ac40602 Deliver index.html per default 2022-01-11 06:37:11 +01:00
Filip Krumpe 395d77b71c close menu after selection 2022-01-11 06:34:33 +01:00
Filip Krumpe 5af2b996d6 Add temp file to .gitignore 2022-01-10 22:37:01 +01:00
Filip Krumpe 119e458c14 Deliver the final svelte-kit build page 2022-01-10 22:32:54 +01:00
Filip Krumpe 8308049a90 Add slider menu and subpages 2022-01-10 22:32:31 +01:00
Filip Krumpe db91d91d05 Initial commit with sveltekit 2022-01-10 20:37:21 +01:00
Filip Krumpe b4d0655f62 Add sidebar menu 2022-01-10 19:47:03 +01:00
Filip Krumpe 1430091143 Add fancy sliding menu 2022-01-04 17:37:42 +01:00
19 changed files with 2085 additions and 173 deletions
+1
View File
@@ -1 +1,2 @@
__pycache__
webapp2/
+9 -1
View File
@@ -11,7 +11,7 @@ Run npm install in the webapp component to instanciate the modules required by s
cd webapp
# to use Typescript run:
# Node scripts/setupTypeScrupt.js
npm install
npm ci
# to start a local development server for the svelte app only:
npm run dev
```
@@ -32,3 +32,11 @@ In the project folder do:
```
Navigate to [http://127.0.0.1:5000/index.html](http://127.0.0.1:5000/index.html) to see the result
# Thanks
Special thanks go to
* [Joshua Nussbaum](https://dev.to/joshnuss/creating-a-sidebar-menu-in-svelte-ih2) for providing this beautiful slider menu
* [Linus Benkner](https://linu.us/sveltekit-with-tailwindcss-v3) for providing the blueprint for the tailwind integration
* [The SvelteKit project](https://kit.svelte.dev/) for providing the Framework
+11 -2
View File
@@ -3,6 +3,15 @@
"singleQuote": true,
"trailingComma": "none",
"printWidth": 100,
"plugins": ["prettier-plugin-svelte"],
"overrides": [{ "files": "*.svelte", "options": { "parser": "svelte" } }]
"plugins": [
"prettier-plugin-svelte"
],
"overrides": [
{
"files": "*.svelte",
"options": {
"parser": "svelte"
}
}
]
}
+10
View File
@@ -0,0 +1,10 @@
{
"compilerOptions": {
"baseUrl": ".",
"paths": {
"$lib": ["src/lib"],
"$lib/*": ["src/lib/*"]
}
},
"include": ["src/**/*.d.ts", "src/**/*.js", "src/**/*.svelte"]
}
+1851 -153
View File
File diff suppressed because it is too large Load Diff
+7 -2
View File
@@ -12,7 +12,6 @@
"format": "prettier --write ."
},
"devDependencies": {
"@sveltejs/adapter-auto": "^3.0.0",
"@sveltejs/adapter-static": "^3.0.1",
"@sveltejs/kit": "^2.0.0",
"@sveltejs/vite-plugin-svelte": "^3.0.0",
@@ -26,9 +25,15 @@
"prettier-plugin-svelte": "^3.1.2",
"svelte": "^4.2.7",
"svelte-check": "^3.6.0",
"tailwindcss": "^3.4.3",
"tslib": "^2.4.1",
"typescript": "^5.0.0",
"vite": "^5.0.3"
},
"type": "module"
"type": "module",
"dependencies": {
"autoprefixer": "^10.4.19",
"cssnano": "^7.0.1",
"postcss": "^8.4.38"
}
}
+19
View File
@@ -0,0 +1,19 @@
const tailwindcss = require("tailwindcss")
const autoprefixer = require("autoprefixer")
const cssnano = require("cssnano")
const mode = process.env.NODE_ENV
const dev = mode === "development"
const config = {
plugins: [
tailwindcss(),
autoprefixer(),
!dev &&
cssnano({
preset: "default",
})
]
}
module.exports = config
+12
View File
@@ -0,0 +1,12 @@
@tailwind base;
@tailwind components;
@tailwind utilities;
@layer base {
h1 {
@apply text-2xl;
}
h2 {
@apply text-xl;
}
}
+3
View File
@@ -1,12 +1,15 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="%sveltekit.assets%/favicon.png" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
%sveltekit.head%
</head>
<body data-sveltekit-preload-data="hover">
<div style="display: contents">%sveltekit.body%</div>
</body>
</html>
+1
View File
@@ -0,0 +1 @@
/// <reference types="@sveltejs/kit" />
+44
View 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
View File
@@ -0,0 +1,9 @@
<svg width=100% height=30>
<text x=0 y=20>ACME</text>
</svg>
<style>
text {
fill: currentColor
}
</style>

After

Width:  |  Height:  |  Size: 111 B

+4
View 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
View 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>
+25
View File
@@ -0,0 +1,25 @@
<script>
export let open = false
function close() {
open = false
}
</script>
<aside class="absolute w-full h-full bg-gray-200 border-r-2 shadow-lg z-10" class:open>
<nav class="p-12 text-xl">
<a class="block" href="/" on:click={close}>Home</a>
<a class="block" href="/about" on:click={close}>About</a>
</nav>
</aside>
<style>
aside {
left: -100%;
transition: left 0.3s ease-in-out
}
.open {
left: 0
}
</style>
+26
View File
@@ -0,0 +1,26 @@
<script>
import Navbar from '$lib/menu/Navbar.svelte';
import Sidebar from '$lib/menu/Sidebar.svelte';
import '../app.css';
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>
+2
View File
@@ -1,2 +1,4 @@
<main class="w-full h-full">
<h1>Welcome to SvelteKit</h1>
<p>Visit <a href="https://kit.svelte.dev">kit.svelte.dev</a> to read the documentation</p>
</main>
+6
View File
@@ -0,0 +1,6 @@
<svelte:head>
<title>About</title>
</svelte:head>
<h1>About this site</h1>
<p>TODO ...</p>
+14
View File
@@ -0,0 +1,14 @@
const config = {
mode: "jit",
content: ["./src/**/*.{html,js,svelte,ts}"],
theme: {
extend: {
fontFamily: {
sans: ["Baar Sophia", "Arial"],
}
},
},
plugins: [],
}
module.exports = config