Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: update post styling #18

Merged
merged 1 commit into from
Sep 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions app/components/posts/detail/PostDetailHeader.css.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { css } from "hono/css";

const postDetailHeaderWrapper = css`
margin-bottom: 32px;
`;

const postDetailHeaderTitle = css`
font-size: 32px;
font-weight: bold;
`;

const postDetailHeaderDivider = css`
margin-top: 16px;
margin-bottom: 12px;
background: transparent;
border-bottom: 1px solid #d0d7de;
height: 1px;
padding: 0;
background-color: #d0d7de;
border: 0;
`;

export { postDetailHeaderWrapper, postDetailHeaderTitle, postDetailHeaderDivider };
22 changes: 22 additions & 0 deletions app/components/posts/detail/PostDetailHeader.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import type { FC } from "hono/jsx";
import { postDetailHeaderDivider, postDetailHeaderTitle, postDetailHeaderWrapper } from "./PostDetailHeader.css";

type Props = {
title: string;
publishedAt: string;
};

const PostDetailHeader: FC<Props> = ({ title, publishedAt }) => {
return (
<div class={postDetailHeaderWrapper}>
<h1 class={postDetailHeaderTitle}>{title}</h1>
<hr class={postDetailHeaderDivider} />
<time>
<span>Posted at </span>
{publishedAt}
</time>
</div>
);
};

export { PostDetailHeader };
2 changes: 1 addition & 1 deletion app/global.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {} from "hono";

type Head = {
title?: string;
description?: string;
publishedAt?: string;
};

declare module "hono" {
Expand Down
6 changes: 3 additions & 3 deletions app/routes/_renderer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,11 @@ export default jsxRenderer(({ children, title }) => {
<title>{_title}</title>
</head>
<body class={bodyLayout}>
<ErrorBoundary fallback={<p>Sorry, Out of Service.</p>}>
<HeaderMemorized />
<HeaderMemorized />
<ErrorBoundary fallback={<p>Sorry, something wrong with this page.</p>}>
<main>{children}</main>
<FooterMemorized />
</ErrorBoundary>
<FooterMemorized />
</body>
</html>
);
Expand Down
2 changes: 2 additions & 0 deletions app/routes/posts/_renderer.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import { jsxRenderer } from "hono/jsx-renderer";
import { PostDetailHeader } from "../../components/posts/detail/PostDetailHeader";

export default jsxRenderer(({ children, Layout, frontmatter }) => {
return (
<Layout title={frontmatter?.title}>
<PostDetailHeader title={frontmatter?.title ?? ""} publishedAt={frontmatter?.publishedAt ?? ""} />
<article class="markdown-body">{children}</article>
</Layout>
);
Expand Down
6 changes: 3 additions & 3 deletions app/routes/posts/md_test.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ title: "Markdown試し打ち"
publishedAt: "2024-09-XX"
---

# # Markdown試し打ち
# # Section1

これはMarkdownの試し打ちです。適宜チューニングしていきたい。以下、怪文書が続きます。

## ## Section 1
## ## Section 2

**以下は、法学部の生徒が学ぶ代表的な法律の分野です。**

Expand All @@ -24,7 +24,7 @@ publishedAt: "2024-09-XX"
>
> Shakespeare

### ### Section 2
### ### Section 3

~ねこ~ いぬ(w300 * h200)
<img width="300" height="200" src="https://images.dog.ceo/breeds/terrier-welsh/lucy.jpg" />
Expand Down