Skip to content

Commit

Permalink
feat: Editボタン追加
Browse files Browse the repository at this point in the history
  • Loading branch information
yossydev committed Oct 14, 2024
1 parent d2806c9 commit d2363f2
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 2 deletions.
3 changes: 3 additions & 0 deletions app/global.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ import {} from "hono";
type Head = {
title?: string;
description?: string;
date?: string;
updatedAt?: string;
path?: string;
};

declare module "hono" {
Expand Down
15 changes: 14 additions & 1 deletion app/islands/SnsButton.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
import type { FC } from "hono/jsx";
import { LINK } from "../constants";

const SnsButton: FC<{ title: string }> = ({ title }) => {
type Props = {
title: string;
path: string;
};

const SnsButton: FC<Props> = ({ title, path }) => {
if (typeof window === "undefined") {
return (
<div class="flex items-center justify-center mt-10 gap-3 ">
Expand Down Expand Up @@ -37,6 +42,14 @@ const SnsButton: FC<{ title: string }> = ({ title }) => {
>
Follow @yossydev
</a>
<a
href={`${LINK.GITHUB}/blog/blob/main/app/routes/posts/${path}.mdx`}
target={"_blank"}
rel={"noreferrer"}
class="bg-blue-200 flex items-center text-sm rounded-3xl py-3 px-4"
>
✏ Edit
</a>
</div>
);
};
Expand Down
12 changes: 11 additions & 1 deletion app/routes/posts/_renderer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,20 @@ export default jsxRenderer(({ children, Layout, frontmatter }) => {
<Layout title={_title} description={frontmatter?.description}>
<div class="markdown">
<h1>{frontmatter?.title}</h1>
<dl class="flex items-center gap-3">
<div class="flex items-center gap-1">
<dt>publishedAt: </dt>
<dd>{frontmatter?.date}</dd>
</div>
<div class="flex items-center gap-1">
<dt>updatedAt: </dt>
<dd>{frontmatter?.updatedAt}</dd>
</div>
</dl>
{children}
</div>
<LikeButton />
<SnsButton title={_title} />
<SnsButton title={_title} path={frontmatter?.path ?? ""} />
</Layout>
);
});
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ title: "Chrome 130でのCSSネスティング改善: CSSNestedDeclarationsの詳
description: "web.devが先日、CSS nesting improves with CSSNestedDeclarationsというブログを公開しました。このブログでは、CSSネスティングの仕様にCSSNestedDeclarationsが追加されたことについて書かれています。導入背景やCSSOMの動きなどが少し面白かったのでブログにまとめました。"
date: "2024/10/13"
updatedAt: "2024/10/13"
path: "css-nesting-improves-with-cssnesteddeclarations"
published: true
---

Expand Down

0 comments on commit d2363f2

Please sign in to comment.