diff --git a/src/lib/card-collections/cards/EmptyCard.svelte b/src/lib/card-collections/cards/EmptyCard.svelte new file mode 100644 index 0000000..5159d71 --- /dev/null +++ b/src/lib/card-collections/cards/EmptyCard.svelte @@ -0,0 +1,19 @@ +
+ +
+ + diff --git a/src/lib/card-collections/cards/PostCard.svelte b/src/lib/card-collections/cards/PostCard.svelte new file mode 100644 index 0000000..cfa4690 --- /dev/null +++ b/src/lib/card-collections/cards/PostCard.svelte @@ -0,0 +1,7 @@ + + + + \ No newline at end of file diff --git a/src/lib/card-collections/cards/ProjectCard.svelte b/src/lib/card-collections/cards/ProjectCard.svelte new file mode 100644 index 0000000..cfa4690 --- /dev/null +++ b/src/lib/card-collections/cards/ProjectCard.svelte @@ -0,0 +1,7 @@ + + + + \ No newline at end of file diff --git a/src/lib/card-collections/cards/TagsCard.svelte b/src/lib/card-collections/cards/TagsCard.svelte new file mode 100644 index 0000000..fb02ef8 --- /dev/null +++ b/src/lib/card-collections/cards/TagsCard.svelte @@ -0,0 +1,31 @@ + + + + {#await fetchTags()} +

Loading Tags...

+ {:then tags} + {#each tags as tag} + + {/each} + {:catch} +

Unable to load tags

+ {/await} +
diff --git a/src/lib/database/mongo.ts b/src/lib/database/mongo.server.ts similarity index 100% rename from src/lib/database/mongo.ts rename to src/lib/database/mongo.server.ts diff --git a/src/lib/global.css b/src/lib/global.css index e63f1d3..01387ae 100644 --- a/src/lib/global.css +++ b/src/lib/global.css @@ -1,8 +1,11 @@ :root { --main-bg-color: lightslategrey; - --accent-color: darkslategrey; + --accent-color: rgb(234, 255, 97); + --accent-rollover: yellow; --overlay-color: #2f4f4fb8; --main-text-color: azure; + --light-text-color: azure; + --dark-text-color: rgb(56, 56, 7); --link-color: cyan; --link-visited-color: rgb(189, 0, 189); } @@ -16,6 +19,15 @@ font-style: normal; } +@font-face { + font-family: 'caprasimo'; + src: url('/font/caprasimo-regular.woff2') format('woff2'), + url('/font/caprasimo-regular.woff') format('woff'), + url('/font/caprasimo-regular.ttf') format('truetype'); + font-weight: normal; + font-style: normal; +} + html { background-color: var(--main-bg-color); text-align: center; diff --git a/src/lib/header.svelte b/src/lib/header.svelte index bb478da..08843ed 100644 --- a/src/lib/header.svelte +++ b/src/lib/header.svelte @@ -13,13 +13,19 @@ diff --git a/src/lib/posts/PostTag.svelte b/src/lib/posts/PostTag.svelte new file mode 100644 index 0000000..7821a36 --- /dev/null +++ b/src/lib/posts/PostTag.svelte @@ -0,0 +1,23 @@ + + + + {tag} + + + diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte index 2b89039..af710db 100644 --- a/src/routes/+page.svelte +++ b/src/routes/+page.svelte @@ -3,19 +3,18 @@ import Header from '$lib/header.svelte'; import Emphasis from '$lib/highlights/emphasis.svelte'; import LatestPosts from '$lib/posts/PostsSummary.svelte'; + import TagsCard from '$lib/card-collections/cards/TagsCard.svelte'; const title: string = "Hi, I'm Fred"; - const subtitle: string = 'Crafting Digital'; -
+

Alongside the railway's iron path, I earn my living and fuel my passions. By day, I'm woven - into the rail's story. By night, I craft, design and build tools that work for people. My - canvas? The web, and beyond. + into the rail's story. By night, I craft, design and build tools that work for people.

With a family close to heart, I capture life's moments through photography and dabble in @@ -41,6 +40,7 @@

Tags

+
@@ -138,10 +138,14 @@ #meta-links { flex-direction: row; justify-content: space-between; - align-items: center; + align-items: start; } .col { width: 30%; } } + + h1 { + font-family: caprasimo; + } diff --git a/src/routes/posts/[slug]/+page.server.ts b/src/routes/posts/[slug]/+page.server.ts index b2efd56..9c785f2 100644 --- a/src/routes/posts/[slug]/+page.server.ts +++ b/src/routes/posts/[slug]/+page.server.ts @@ -1,4 +1,4 @@ -import { mongoConnect } from '$lib/database/mongo'; +import { mongoConnect } from '$lib/database/mongo.server'; import { marked } from 'marked'; import * as path from 'path'; import sanitizeHtml from 'sanitize-html'; @@ -44,14 +44,14 @@ export async function load({ params }) { function renderMarkdown(md: string, renderer: _Renderer): string { const rawHtml = marked(md, { renderer }); - console.log(rawHtml) + console.log(rawHtml); const sanitizedHtml = sanitizeHtml(rawHtml, { allowedTags: ['a', 'br', 'code', 'figcaption', 'figure', 'img', 'p', 'pre'], allowedAttributes: { - 'a': ['href'], - 'img': ['alt', 'class', 'src', 'title'] + a: ['href'], + img: ['alt', 'class', 'src', 'title'] } }); - console.log(sanitizedHtml) - return sanitizedHtml + console.log(sanitizedHtml); + return sanitizedHtml; } diff --git a/src/routes/posts/[slug]/+page.svelte b/src/routes/posts/[slug]/+page.svelte index 486d75e..c9400ec 100644 --- a/src/routes/posts/[slug]/+page.svelte +++ b/src/routes/posts/[slug]/+page.svelte @@ -1,5 +1,6 @@ -

Testing

+
{#each posts as article} diff --git a/src/routes/posts/tag/all/+server.ts b/src/routes/posts/tag/all/+server.ts new file mode 100644 index 0000000..0f076a2 --- /dev/null +++ b/src/routes/posts/tag/all/+server.ts @@ -0,0 +1,16 @@ +// Fetches all tags and returns a JSON Array of the tags ordered in their frequency of use + +import { error } from '@sveltejs/kit'; +import type { RequestHandler } from '@sveltejs/kit'; +import { json } from '@sveltejs/kit'; + +import { mongoConnect } from '$lib/database/mongo.server'; + +export async function GET({ url }) { + const db = await mongoConnect(); + const col = db.db('fredboniface').collection('posts'); + // Fetch all possible array values for 'tags' and creata a local `tags` array to return + // For now, a static array is used. + const tags = ['svelte', 'sveltekit', 'misc', 'model-rail', 'typescript', 'waffle']; + return json(tags); +} diff --git a/static/font/caprasimo-regular.ttf b/static/font/caprasimo-regular.ttf new file mode 100644 index 0000000..d058bab Binary files /dev/null and b/static/font/caprasimo-regular.ttf differ diff --git a/static/font/caprasimo-regular.woff b/static/font/caprasimo-regular.woff new file mode 100644 index 0000000..fd7d14f Binary files /dev/null and b/static/font/caprasimo-regular.woff differ diff --git a/static/font/caprasimo-regular.woff2 b/static/font/caprasimo-regular.woff2 new file mode 100644 index 0000000..56e5b82 Binary files /dev/null and b/static/font/caprasimo-regular.woff2 differ