Skip to content

Commit

Permalink
docs: favicon + title
Browse files Browse the repository at this point in the history
  • Loading branch information
ubermanu committed May 30, 2023
1 parent e2f3b39 commit 6d41dfd
Show file tree
Hide file tree
Showing 7 changed files with 53 additions and 26 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
"@testing-library/svelte": "^3.2.2",
"@ubermanu/prettier-config": "^1.7.1",
"autoprefixer": "^10.4.14",
"case": "^1.6.3",
"highlight.js": "^11.8.0",
"jest-mock": "^29.5.0",
"jsdom": "^21.1.1",
Expand Down
8 changes: 8 additions & 0 deletions pnpm-lock.yaml

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

24 changes: 24 additions & 0 deletions src/routes/(docs)/+layout.server.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { base } from '$app/paths'
import fs from 'node:fs/promises'
import path from 'node:path'
import type { LayoutServerLoad } from './$types.js'

export const load: LayoutServerLoad = async () => {
const __dirname = path.dirname(import.meta.url.replace('file://', ''))

// Get the list of components in the component folder
const folders = await fs.readdir(path.join(__dirname, './component'))

const components = folders.map((folder) => {
return {
name: folder.replace(/-/g, ' ').replace(/\w\S*/g, (txt) => {
return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase()
}),
url: `${base}/component/${folder}`,
}
})

return {
components,
}
}
25 changes: 0 additions & 25 deletions src/routes/+layout.server.ts
Original file line number Diff line number Diff line change
@@ -1,26 +1 @@
import { base } from '$app/paths'
import fs from 'node:fs/promises'
import path from 'node:path'
import type { LayoutServerLoad } from './$types.js'

export const load: LayoutServerLoad = async () => {
const __dirname = path.dirname(import.meta.url.replace('file://', ''))

// Get the list of components in the component folder
const folders = await fs.readdir(path.join(__dirname, './(docs)/component'))

const components = folders.map((folder) => {
return {
name: folder.replace(/-/g, ' ').replace(/\w\S*/g, (txt) => {
return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase()
}),
url: `${base}/component/${folder}`,
}
})

return {
components,
}
}

export const prerender = true
13 changes: 13 additions & 0 deletions src/routes/+layout.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,21 @@
import '../app.css'
import '../highlight.less'
import Header from './Header.svelte'
import { page } from '$app/stores'
import Case from 'case'
$: subtitle = $page.url.pathname.split('/').filter(Boolean).pop() || ''
$: subtitle = Case.title(subtitle)
</script>

<svelte:head>
{#if subtitle.length > 0}
<title>Louisette | {subtitle}</title>
{:else}
<title>Louisette</title>
{/if}
</svelte:head>

<main
class="flex min-h-screen w-full flex-col bg-gray-100 text-neutral-900 dark:bg-neutral-800 dark:text-neutral-100"
>
Expand Down
8 changes: 7 additions & 1 deletion src/routes/Header.svelte
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<script>
import { base } from '$app/paths'
import { Github } from 'lucide-svelte'
import { Github, Menu } from 'lucide-svelte'
import DarkMode from './DarkMode.svelte'
import logo from '$images/louisette.svg'
import { page } from '$app/stores'
</script>

<div class="container mx-auto flex max-w-6xl items-center gap-4 p-4 pb-0">
Expand All @@ -22,5 +23,10 @@
<Github /> <span class="hidden md:inline">GitHub</span>
</a>
<DarkMode />
{#if $page.data.components}
<div class="cursor-pointer rounded p-2 md:hidden">
<Menu />
</div>
{/if}
</div>
</div>
Binary file modified static/favicon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 6d41dfd

Please sign in to comment.