From 4df5603222804906143f3b1412ea8cd2f5f6ee0a Mon Sep 17 00:00:00 2001 From: cupcakearmy Date: Wed, 23 Sep 2020 15:37:12 +0200 Subject: [PATCH] portet blog --- package.json | 1 + src/components/ImageFrame.svelte | 23 +++++++++++ src/components/Nav.svelte | 2 +- src/components/PageTitle.svelte | 3 +- src/components/PostAttributes.svelte | 31 +++++++++++++++ src/components/PostPreview.svelte | 46 ++++++++++++++++++++++ src/components/SimplePage.svelte | 11 +++++- src/components/SpacedLetters.svelte | 12 ++++-- src/components/WPAdapter.svelte | 59 ++++++++++++++++++++++++++++ src/components/Work.svelte | 14 ++++--- src/lib/readingTime.js | 6 +++ src/lib/wp.js | 26 +++++++++--- src/routes/about.svelte | 2 +- src/routes/blog/[slug].svelte | 21 ++++++++++ src/routes/blog/index.svelte | 25 ++++++++++++ static/global.css | 9 ++--- yarn.lock | 5 +++ 17 files changed, 271 insertions(+), 25 deletions(-) create mode 100644 src/components/ImageFrame.svelte create mode 100644 src/components/PostAttributes.svelte create mode 100644 src/components/PostPreview.svelte create mode 100644 src/components/WPAdapter.svelte create mode 100644 src/lib/readingTime.js create mode 100644 src/routes/blog/[slug].svelte create mode 100644 src/routes/blog/index.svelte diff --git a/package.json b/package.json index bdf6869..8efed08 100644 --- a/package.json +++ b/package.json @@ -8,6 +8,7 @@ "dependencies": { "axios": "^0.20.0", "compression": "^1.7.1", + "dayjs": "^1.8.36", "polka": "next", "sirv": "^1.0.0" }, diff --git a/src/components/ImageFrame.svelte b/src/components/ImageFrame.svelte new file mode 100644 index 0000000..e23a165 --- /dev/null +++ b/src/components/ImageFrame.svelte @@ -0,0 +1,23 @@ + + + + + diff --git a/src/components/Nav.svelte b/src/components/Nav.svelte index 16c6b38..78d71a5 100644 --- a/src/components/Nav.svelte +++ b/src/components/Nav.svelte @@ -5,7 +5,7 @@ { name: 'About', href: '/about' }, { name: 'Works', href: '/works' }, { name: 'Projects', href: '/projects' }, - { name: 'Blog', href: 'https://blog.nicco.io' }, + { name: 'Blog', href: '/blog' }, { name: 'Contact', href: '/contact' }, ] diff --git a/src/components/PageTitle.svelte b/src/components/PageTitle.svelte index ee1459e..5be6c01 100644 --- a/src/components/PageTitle.svelte +++ b/src/components/PageTitle.svelte @@ -2,6 +2,7 @@ import SpacedLetters from './SpacedLetters.svelte' export let title = '' + export let readable = false + +
+
+ {created} + {#if full && created !== modified}
Last update:{modified}{/if} +
+
~ {readingTimeInMinutes(post.content)} min
+
diff --git a/src/components/PostPreview.svelte b/src/components/PostPreview.svelte new file mode 100644 index 0000000..e241d71 --- /dev/null +++ b/src/components/PostPreview.svelte @@ -0,0 +1,46 @@ + + + + + + {#if post.featured} + + {/if} + +

+ {@html post.title} +

+
diff --git a/src/components/SimplePage.svelte b/src/components/SimplePage.svelte index 5e9b251..1b8a1c5 100644 --- a/src/components/SimplePage.svelte +++ b/src/components/SimplePage.svelte @@ -2,16 +2,23 @@ import PageTitle from './PageTitle.svelte' export let title = '' + export let expanded = true + export let readable = false - + -
+
diff --git a/src/components/SpacedLetters.svelte b/src/components/SpacedLetters.svelte index 36f5873..c2c2282 100644 --- a/src/components/SpacedLetters.svelte +++ b/src/components/SpacedLetters.svelte @@ -1,6 +1,7 @@ -
+
{#if even} - {#each letters as letter} - {letter} - {/each} + {#each letters as letter}{letter}{/each} {:else}{letters}{/if}
diff --git a/src/components/WPAdapter.svelte b/src/components/WPAdapter.svelte new file mode 100644 index 0000000..18ae57c --- /dev/null +++ b/src/components/WPAdapter.svelte @@ -0,0 +1,59 @@ + + + + +
+ {@html content} +
diff --git a/src/components/Work.svelte b/src/components/Work.svelte index 71d88a4..c9bafb9 100644 --- a/src/components/Work.svelte +++ b/src/components/Work.svelte @@ -1,12 +1,10 @@