Skip to content

Commit

Permalink
Chore: apply prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
yongsk0066 committed Apr 10, 2024
1 parent e5fef41 commit 49da4b1
Show file tree
Hide file tree
Showing 8 changed files with 33 additions and 18 deletions.
11 changes: 10 additions & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
{
"trailingComma": "es5",
"tabWidth": 2,
"semi": true
"semi": true,
"plugins": ["prettier-plugin-astro"],
"overrides": [
{
"files": "*.astro",
"options": {
"parser": "astro"
}
}
]
}
6 changes: 5 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
{
"typescript.tsdk": "node_modules/typescript/lib"
"typescript.tsdk": "node_modules/typescript/lib",
"prettier.documentSelectors": ["**/*.astro"],
"[astro]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
}
}
Binary file modified .yarn/install-state.gz
Binary file not shown.
16 changes: 8 additions & 8 deletions src/components/FormattedDate.astro
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
---
interface Props {
date: Date;
date: Date;
}
const { date } = Astro.props;
---

<time datetime={date.toISOString()}>
{
date.toLocaleDateString('en-us', {
year: 'numeric',
month: 'short',
day: 'numeric',
})
}
{
date.toLocaleDateString("en-us", {
year: "numeric",
month: "short",
day: "numeric",
})
}
</time>
12 changes: 8 additions & 4 deletions src/components/LinkPreview.astro
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,19 @@
interface Props {
src: string;
}
import jsdom from 'jsdom';
import jsdom from "jsdom";
const { src } = Astro.props;
const response = await fetch(src);
const html = await response.text();
const { document } = new jsdom.JSDOM(html)?.window;
const title = document.querySelector('title')?.textContent;
const description = document.querySelector('meta[name=description]')?.getAttribute('content');
const image = document.querySelector("meta[property='og:image']")?.getAttribute('content');
const title = document.querySelector("title")?.textContent;
const description = document
.querySelector("meta[name=description]")
?.getAttribute("content");
const image = document
.querySelector("meta[property='og:image']")
?.getAttribute("content");
---

<a class="link-preview" href={src} target="_blank" rel="noopener noreferrer">
Expand Down
1 change: 0 additions & 1 deletion src/content/blog/어떻게 문제를 풀 것인가.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ author: "Yongseok"
pubDate: "Feb 10 2024"
categories: ["book"]
heroImage: "/how_to_solve_it_placeholder.png"

---


Expand Down
3 changes: 1 addition & 2 deletions src/layouts/BlogPost.astro
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
---
import type { CollectionEntry } from "astro:content";
import BaseHead from "../components/BaseHead.astro";
import Header from "../components/Header.astro";
import Footer from "../components/Footer.astro";
import FormattedDate from "../components/FormattedDate.astro";
import Header from "../components/Header.astro";
type Props = CollectionEntry<"blog">["data"];
Expand Down Expand Up @@ -68,7 +68,6 @@ const { title, description, pubDate, updatedDate, heroImage, categories } =
}
</style>
</head>

<body>
<Header />
<main>
Expand Down
2 changes: 1 addition & 1 deletion src/pages/about.astro
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,6 @@ import Layout from "../layouts/BlogPost.astro";
Hi! 👋<br /> My name is YongSeok Jang <br /> and I am a frontend engineer.
<br />
<br />
Based in Seoul, South Korea. 🇰🇷
Based in Seoul, South Korea. 🇰🇷
</h1>
</Layout>

0 comments on commit 49da4b1

Please sign in to comment.