Skip to content

Commit

Permalink
Better title styling
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielPower committed May 21, 2024
1 parent c37ee9e commit 7f147ad
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/lib/utils/string.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export const capitalize = (str: string) =>
str
.split(" ")
.map((s) => s[0].toUpperCase() + s.slice(1))
.join(" ");
8 changes: 7 additions & 1 deletion src/routes/page/[page]/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import { gfm } from "@milkdown/preset-gfm";
import { listener, listenerCtx } from "@milkdown/plugin-listener";
import { diagram } from "@milkdown/plugin-diagram";
import { capitalize } from "$lib/utils/string";
export let data: PageData;
let unsavedMarkdown: string | null = null;
Expand Down Expand Up @@ -69,11 +70,16 @@
</script>

<div class="page">
<h1>{data.fileName}</h1>
<div class="title">{capitalize(data.fileName)}</div>
<div use:editor></div>
</div>

<style>
.title {
font-size: 2rem;
text-align: center;
color: var(--lavender);
}
.page {
padding: 1rem;
}
Expand Down

0 comments on commit 7f147ad

Please sign in to comment.