Skip to content
This repository has been archived by the owner on Oct 3, 2024. It is now read-only.

Add search bar, fix storybook, fix other minor errors #186

Merged
merged 1 commit into from
May 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 62 additions & 18 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 7 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,13 @@
},
"type": "module",
"dependencies": {
"@fontsource-variable/roboto-mono": "^5.0.9",
"@fontsource-variable/roboto-slab": "^5.0.12",
"shiki": "^1.5.2"
"@fontsource-variable/roboto-mono": "^5.0.19",
"@fontsource-variable/roboto-slab": "^5.0.20",
"flexsearch": "^0.7.43",
"shiki": "^1.6.1",
"shiki-es": "^0.14.0",
"vscode-oniguruma": "^2.0.1",
"vscode-textmate": "^9.0.0"
},
"packageManager": "[email protected]"
}
2 changes: 1 addition & 1 deletion src/app.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
<link rel="shortcut icon" href="%sveltekit.assets%/favicons/favicon.ico" />

<link rel="icon" href="%sveltekit.assets%/favicons/favicon.png" />
<link rel="icon" type="image/x-icon" href="/favicon.ico" />
<link rel="icon" type="image/x-icon" href="/favicons/favicon.ico" />

<!-- Tell browser this site is responsive -->
<meta name="viewport" content="width=device-width, initial-scale=1" />
Expand Down
7 changes: 5 additions & 2 deletions src/lib/components/organisms/Header.story.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
import '$lib/scss/global.scss';
import type { Hst as HstType } from '@histoire/plugin-svelte';
import Header from './Header.svelte';
import type { BlogPost } from '$lib/utils/types';

export let posts: BlogPost[];

export let Hst: HstType;
</script>
Expand All @@ -12,10 +15,10 @@
layout={{ type: 'single', iframe: true }}
>
<svelte:component this={Hst.Variant} title="Transparent Background">
<Header />
<Header {posts} />
</svelte:component>

<svelte:component this={Hst.Variant} title="With Background">
<Header showBackground />
<Header showBackground {posts} />
</svelte:component>
</svelte:component>
14 changes: 13 additions & 1 deletion src/lib/components/organisms/Header.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,12 @@
import RssLink from '$lib/components/atoms/RssLink.svelte';
import Socials from '$lib/components/molecules/Socials.svelte';
import AnimatedHamburger from '$lib/components/singletons/AnimatedHamburger.svelte';
import Strap from '../singletons/Strap.svelte';
import Strap from '$lib/components/singletons/Strap.svelte';
import SearchBar from '$lib/components/singletons/SearchBar.svelte';
import type { BlogPost } from '$lib/utils/types';

export let showBackground = false;
export let posts: BlogPost[];

let isMenuOpen = false;

Expand All @@ -17,6 +20,12 @@
function closeMenu() {
isMenuOpen = false;
}

function handleLinkClick() {
isMenuOpen = false;
}

let searchTerm = '';
</script>

<Strap />
Expand All @@ -28,6 +37,9 @@
<AnimatedHamburger {isMenuOpen} {toggleMenu}>
<div class="links-wrapper">
<ul class="links">
<li>
<SearchBar {searchTerm} on:linkClick={handleLinkClick} {posts} />
</li>
<li>
<a href="/blog">Blog</a>
</li>
Expand Down
33 changes: 17 additions & 16 deletions src/lib/components/singletons/PrevNextPost.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -23,27 +23,27 @@
</script>

<div class="container">
<div class="nextPost">
{#if nextPost}
<a href="/{nextPost.slug}">{nextPost.title}</a>
<div class="arrow arrowNext">
<div class="previousPost">
{#if prevPost}
<a href="/{prevPost.slug}">{prevPost.title}</a>
<div class="arrow arrowPrevious">
<Icon icon="material-symbols:arrow-left" width="44" height="44" style="color: #650000" />
<p>Next Post</p>
<p>Previous Post</p>
</div>
{:else}
<h3 class="inactive">You're up to date. More to come soon!</h3>
<h3 class="inactive">You are reading our first post.</h3>
{/if}
</div>

<div class="previousPost">
{#if prevPost}
<a href="/{prevPost.slug}">{prevPost.title}</a>
<div class="arrow arrowPrevious">
<p>Previous Post</p>
<div class="nextPost">
{#if nextPost}
<a href="/{nextPost.slug}">{nextPost.title}</a>
<div class="arrow arrowNext">
<p>Next Post</p>
<Icon icon="material-symbols:arrow-right" width="44" height="44" style="color: #650000" />
</div>
{:else}
<h3 class="inactive">You are reading our first post.</h3>
<h3 class="inactive">You're up to date. More to come soon!</h3>
{/if}
</div>
</div>
Expand All @@ -64,11 +64,12 @@
}

.nextPost {
border-right: 1px solid #979797;
border-left: 1px solid #979797;
text-align: right;
}

.previousPost {
text-align: right;
text-align: left;
}

.arrow {
Expand All @@ -77,11 +78,11 @@
}

.arrowNext {
justify-content: flex-start;
justify-content: flex-end;
}

.arrowPrevious {
justify-content: flex-end;
justify-content: flex-start;
}

.inactive {
Expand Down
Loading