Skip to content

Commit

Permalink
Refactor how templates are defined.
Browse files Browse the repository at this point in the history
  • Loading branch information
smack0007 committed May 17, 2024
1 parent 8e169cb commit 26d75b9
Show file tree
Hide file tree
Showing 7 changed files with 234 additions and 261 deletions.
7 changes: 1 addition & 6 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
[B|b]in/
[O|o]bj/
.cache/
.vs/
bin/
node_modules/
dist/

*.suo
commit.msg
6 changes: 5 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
{
"deno.enable": true,

"editor.tabSize": 2
"editor.tabSize": 2,

"[typescriptreact]": {
"editor.defaultFormatter": "denoland.vscode-deno"
}
}
30 changes: 14 additions & 16 deletions src/templates/index.tsx
Original file line number Diff line number Diff line change
@@ -1,21 +1,19 @@
import { html, Post } from "~/compiler/index.ts";
import { PostHeaderTemplate } from "./postHeader.tsx";

export function IndexTemplate(posts: Post[]): string {
return posts
.map((post) => (
<div class="post">
{PostHeaderTemplate(post)}
<div class="content">
{post.excerpt}
export const IndexTemplate = (posts: Post[]) => posts
.map((post) => (
<div class="post">
{PostHeaderTemplate(post)}
<div class="content">
{post.excerpt}

{post.hasExcerpt && (
<a class="readMore" href={post.url}>
Read More
</a>
)}
</div>
{post.hasExcerpt && (
<a class="readMore" href={post.url}>
Read More
</a>
)}
</div>
))
.join("");
}
</div>
))
.join("");
Loading

0 comments on commit 26d75b9

Please sign in to comment.