-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d89f315
commit b1f6694
Showing
6 changed files
with
52 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ import { extract } from "https://deno.land/[email protected]/encoding/front_matter.ts" | |
import { join } from "$std/path/mod.ts"; | ||
|
||
import { Handlers, PageProps } from "$fresh/server.ts"; | ||
import he120 from "https://esm.sh/[email protected]"; | ||
|
||
export interface Note { | ||
title: string; | ||
|
@@ -55,17 +56,14 @@ export const handler: Handlers<Note> = { | |
|
||
export default function PostPage(props: PageProps<Note>) { | ||
const post = props.data; | ||
const __html = render(post.content); | ||
return ( | ||
<> | ||
<Head> | ||
<style dangerouslySetInnerHTML={{ __html: CSS }} /> | ||
</Head> | ||
<div> | ||
<h1>{post.title}</h1> | ||
<div | ||
dangerouslySetInnerHTML={{ __html: render(post.content) }} | ||
/> | ||
</div> | ||
<h1 className="font-bold">{post.title}</h1> | ||
<div | ||
class="gfm" | ||
dangerouslySetInnerHTML={{ __html }} | ||
/> | ||
</> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
import { CSS, render } from "https://deno.land/x/[email protected]/mod.ts"; | ||
import { render } from "https://deno.land/x/[email protected]/mod.ts"; | ||
import { Handlers, PageProps } from "$fresh/server.ts"; | ||
import { getAllNote, Note } from "./[slug].tsx"; | ||
|
||
|
@@ -9,35 +9,35 @@ export const handler: Handlers<Note[]> = { | |
}, | ||
}; | ||
|
||
function PostCard(props: { post: Note }) { | ||
function NoteCard(props: { post: Note }) { | ||
const { post } = props; | ||
return ( | ||
<div> | ||
<a className="no-underline" href={`/note/${post.slug}`}> | ||
<h3> | ||
<> | ||
<a class="no-underline" href={`/notes/${post.slug}`}> | ||
<h1 class="font-bold"> | ||
{post.title} | ||
</h3> | ||
</h1> | ||
<time> | ||
{new Date(post.createdAt).toLocaleDateString("en-us", { | ||
{new Date(post.createdAt).toLocaleDateString("ko-kr", { | ||
year: "numeric", | ||
month: "long", | ||
day: "numeric", | ||
})} | ||
</time> | ||
<div dangerouslySetInnerHTML={{ __html: render(post.content) }} /> | ||
<div | ||
class="gfm" | ||
dangerouslySetInnerHTML={{ __html: render(post.content) }} | ||
/> | ||
</a> | ||
</div> | ||
</> | ||
); | ||
} | ||
|
||
export default function BlogIndexPage(props: PageProps<Note[]>) { | ||
const posts = props.data; | ||
return ( | ||
<main> | ||
<h1>Notes</h1> | ||
<div className="break-words border-b border-b-gray-200 pb-6"> | ||
{posts.map((post) => <PostCard post={post} />)} | ||
</div> | ||
</main> | ||
<section class="break-words border-b border-b-gray-200 pb-6"> | ||
{posts.map((post) => <NoteCard post={post} />)} | ||
</section> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,17 @@ | ||
@tailwind base; | ||
@tailwind components; | ||
@tailwind utilities; | ||
@tailwind utilities; | ||
|
||
.gfm { | ||
h1, h2, h3, h4 { | ||
font-weight: bold; | ||
position: relative; | ||
.anchor { | ||
display: none; | ||
svg { | ||
position: absolute; | ||
transform: translate(calc(-100% - 6px), 50%); | ||
} | ||
} | ||
} | ||
} |