-

{post.title}

-

summary:{post.summary}

-

category_name:{post.category_name}

-
{formatDatetime(post.published_at, 'YYYY 年 MM 月 DD 日')}
+
+
{post.published_at}
+
{post.category_name}
+
{post.title}
+
)) @@ -50,31 +53,59 @@ const {list} = await http.get>("post"); background: #fff; padding: 16px; border-radius: 12px; - box-shadow: rgba(149, 157, 165, 0.2) 0px 2px 14px -4px; + box-shadow: rgba(0, 0, 0, 0.05) 0px 1px 2px 0px; display: flex; - gap: 20px; + align-items: center; + transition: transform 0.2s linear; } - .post-content { + .post:hover { + box-shadow: rgba(33, 35, 38, 0.1) 0px 10px 10px -10px; + } + + .published-at { + white-space: nowrap; + font-size: 14px; + color: #4b5563; + min-width: 130px; + margin-right: 20px; + } + + .category-name { + border-radius: 999px; + background: #fceeda; + padding: 4px 12px; + font-size: 14px; + margin-right: 24px; + } + + .post-title { flex: 1; + white-space: nowrap; + text-overflow: ellipsis; overflow: hidden; } - .summary { - font-size: 16px; - color: rgb(66, 63, 63); + .link { } - .cover { - width: 250px; - height: 150px; - border-radius: 8px; - overflow: hidden; + .link svg { + width: 16px; + height: 16px; + color: #6b7280; } - .cover img { - width: 100%; - height: 100%; - object-fit: cover; + @media (max-width: 640px) { + .posts { + gap: 12px; + } + + .published-at { + margin-right: 8px; + } + + .category-name { + display: none; + } } diff --git a/src/pages/posts/[...slug].astro b/src/pages/posts/[...slug].astro index 75f130f..2074c44 100644 --- a/src/pages/posts/[...slug].astro +++ b/src/pages/posts/[...slug].astro @@ -10,73 +10,80 @@ import {formatDatetime} from "@/lib/format.ts"; const {slug} = Astro.params; interface Post { - title: string; - summary: string; - slug: string; - cover: string; - published_at: string; - content: string; + title: string; + summary: string; + slug: string; + cover: string; + published_at: string; + content: string; } const {data} = await http.get>(`post/${slug}`); const content = await highlightHtmlWithJsdom(data.content) + +data.published_at = formatDatetime(data.published_at, 'YYYY 年 M 月 D 日') --- -

{data.title}

+

{data.title}

-
- - - - - - - - - - - - - {formatDatetime(data.published_at,'YYYY 年 MM 月 DD 日')} -
+
+ + + + + + + + + + + + + {data.published_at} +
-
+
diff --git a/src/styles/github-markdown.css b/src/styles/github-markdown.css index 1532fb2..3d4295f 100644 --- a/src/styles/github-markdown.css +++ b/src/styles/github-markdown.css @@ -16,3 +16,8 @@ h1{ border-bottom: none ; } +@media (max-width: 768px) { + .markdown-body pre code{ + font-size: inherit; + } +} diff --git a/src/styles/global.css b/src/styles/global.css index 7a3ea52..72a0040 100644 --- a/src/styles/global.css +++ b/src/styles/global.css @@ -24,4 +24,10 @@ main { width: 100%; margin: 0 auto; padding: 32px; -} \ No newline at end of file +} + +@media (max-width: 768px) { + main{ + padding: 16px; + } +}