diff --git a/package.json b/package.json index d802327..bf347c6 100644 --- a/package.json +++ b/package.json @@ -15,6 +15,7 @@ }, "type": "module", "dependencies": { - "@sveltejs/adapter-static": "^1.0.0-next.26" + "@sveltejs/adapter-static": "^1.0.0-next.26", + "luxon": "^2.3.1" } } \ No newline at end of file diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index c863d5b..88d3613 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -4,11 +4,13 @@ specifiers: '@sveltejs/adapter-auto': next '@sveltejs/adapter-static': ^1.0.0-next.26 '@sveltejs/kit': next + luxon: ^2.3.1 mdsvex: ^0.10.5 svelte: ^3.44.0 dependencies: '@sveltejs/adapter-static': 1.0.0-next.26 + luxon: 2.3.1 devDependencies: '@sveltejs/adapter-auto': 1.0.0-next.30 @@ -369,6 +371,11 @@ packages: engines: {node: '>=6'} dev: true + /luxon/2.3.1: + resolution: {integrity: sha512-I8vnjOmhXsMSlNMZlMkSOvgrxKJl0uOsEzdGgGNZuZPaS9KlefpE9KV95QFftlJSC+1UyCC9/I69R02cz/zcCA==} + engines: {node: '>=12'} + dev: false + /magic-string/0.25.7: resolution: {integrity: sha512-4CrMT5DOHTDk4HYDlzmwu4FVCcIYI8gauveasrdCu2IKIFOJ3f0v/8MDGJCDL9oD2ppz/Av1b0Nj345H9M+XIA==} dependencies: diff --git a/src/app.html b/src/app.html index 5974b72..99580fa 100644 --- a/src/app.html +++ b/src/app.html @@ -4,6 +4,7 @@ + %svelte.head% diff --git a/src/lib/components/contact.svelte b/src/lib/components/contact.svelte index e5c79e9..210f58e 100644 --- a/src/lib/components/contact.svelte +++ b/src/lib/components/contact.svelte @@ -7,13 +7,13 @@
- Github Icon + Github Icon danbulant
- Discord Icon + Discord Icon TechmandanCZ#3372
diff --git a/src/lib/components/heroPost.svelte b/src/lib/components/heroPost.svelte index f09ec09..1b5b8b3 100644 --- a/src/lib/components/heroPost.svelte +++ b/src/lib/components/heroPost.svelte @@ -1,15 +1,16 @@ -
- Thumbnail + + Thumbnail
{#each categories as category} @@ -20,19 +21,22 @@

{description}

Avatar of author - — + {author} - — - {date} + + {relDate}
-
+
\ No newline at end of file diff --git a/src/lib/components/navbar.svelte b/src/lib/components/navbar.svelte new file mode 100644 index 0000000..b28d98e --- /dev/null +++ b/src/lib/components/navbar.svelte @@ -0,0 +1,20 @@ + + +
+ +

Daniel Bulant

+ + + Contact + Blog +
+
\ No newline at end of file diff --git a/src/lib/components/post.svelte b/src/lib/components/post.svelte index 5d660c5..5dfbb14 100644 --- a/src/lib/components/post.svelte +++ b/src/lib/components/post.svelte @@ -6,6 +6,7 @@ export var title; export var authorIcon; export var currentHover; + export var path; var grayscale = false; $: grayscale = currentHover && currentHover !== title; @@ -18,8 +19,8 @@ } -
- Thumbnail + + Thumbnail
{#each categories as category} @@ -35,12 +36,15 @@ {date}
-
+ \ No newline at end of file diff --git a/src/lib/stores/darkmode.js b/src/lib/stores/darkmode.js index 8a817ce..a0c46dc 100644 --- a/src/lib/stores/darkmode.js +++ b/src/lib/stores/darkmode.js @@ -8,6 +8,15 @@ const darkmode = writable( darkmode.subscribe(v => { if(typeof window !== "undefined") localStorage.setItem("darkmode", JSON.stringify(v)); + + + if(typeof document !== "undefined") { + if(v) { + document.body.classList.add("dark"); + } else { + document.body.classList.remove("dark"); + } + } }); export default darkmode; \ No newline at end of file diff --git a/src/routes/api/posts.json.js b/src/routes/api/posts.json.js new file mode 100644 index 0000000..9276680 --- /dev/null +++ b/src/routes/api/posts.json.js @@ -0,0 +1,27 @@ +import { DateTime } from "luxon"; + +export async function get() { + const allPostFiles = import.meta.glob('../posts/*.md') + const iterablePostFiles = Object.entries(allPostFiles) + + const allPosts = await Promise.all( + iterablePostFiles.map(async ([path, resolver]) => { + const { metadata } = await resolver() + const postPath = path.slice(2, -3) + + return { + ...metadata, + relDate: DateTime.fromISO(metadata.date).toRelativeCalendar(), + path: postPath, + } + }) + ) + + const sortedPosts = allPosts.sort((a, b) => { + return new Date(b.date) - new Date(a.date) + }) + + return { + body: sortedPosts + } +} \ No newline at end of file diff --git a/src/routes/index.svelte b/src/routes/index.svelte index cb197f5..5cb3c3d 100644 --- a/src/routes/index.svelte +++ b/src/routes/index.svelte @@ -1,32 +1,35 @@ + + @@ -34,14 +37,7 @@ -
- -

Daniel Bulant

- - - Contact -
-
+

I'm a young developer making appTypeHover = "websites"} on:mouseleave={() => appTypeHover == "websites" && (appTypeHover = null)}>websites, @@ -120,7 +116,7 @@ Rust
  • technologySelected = "x11"}> - + X11
  • technologySelected = "cs"}> @@ -140,15 +136,15 @@ React
  • technologySelected = "nomad"}> - + Nomad
  • technologySelected = "consul"}> - + Consul
  • technologySelected = "discord"}> - + Discord
  • @@ -186,17 +182,19 @@ Linux
  • technologySelected = "nginx"}> - + Nginx
  • technologySelected = "cloudflare"}> - + Cloudflare
  • - + {#if posts} + + {/if}
    @@ -205,15 +203,19 @@

    Daniel Bulant

    - -

    - Design by Carl Hansen -

    -
    +

    + Design by Carl Hansen +