Skip to content

Commit

Permalink
不要な変更を削除
Browse files Browse the repository at this point in the history
  • Loading branch information
miyaji255 committed Feb 5, 2024
1 parent 0e339a8 commit 372c8c2
Show file tree
Hide file tree
Showing 8 changed files with 47 additions and 34 deletions.
1 change: 0 additions & 1 deletion src/components/blog/tag/TagListSection.astro
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,5 @@ const { title, tags } = Astro.props

<Section background="secondary">
<Fragment slot="title">{title}</Fragment>
<slot name="nav" />
<TagList tags={tags} />
</Section>
2 changes: 1 addition & 1 deletion src/components/blog/tag/TagSmallList.astro
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const { blogCategory, tags } = Astro.props
<li>
<a
href={`/blog/category=${blogCategory}/`}
class="rounded-full bg-white px-2 py-1 text-justify text-sm ring-1 ring-primary"
class="rounded-full bg-white px-2 py-1 text-justify text-sm ring-1 ring-primary hover:bg-gray-200"
>{BlogCategoryMapping[blogCategory]}</a
>
</li>
Expand Down
16 changes: 13 additions & 3 deletions src/components/layout/nav/BlogNav.astro
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const navList = [
] as const satisfies { target: string; title: string; isHere: boolean }[]
---

<div class="flex flex-nowrap gap-3 px-9 pt-1 font-sans text-lg font-medium">
<div class="flex flex-nowrap gap-3 px-9 font-sans text-lg font-medium">
{
navList.map(({ target, title, isHere }) => (
<a
Expand All @@ -32,11 +32,21 @@ const navList = [
{
'text-black after:block after:h-1 after:rounded-t-lg after:bg-primary':
isHere,
'pb-1 text-gray-700 hover:text-black': !isHere,
'text-gray-700 hover:text-black': !isHere,
},
]}
>
<span class="inline-block py-1">{title}</span>
<span
class:list={[
'inline-block pb-1 pt-2',
{
'pb-1': isHere,
'pb-2': !isHere,
},
]}
>
{title}
</span>
</a>
))
}
Expand Down
17 changes: 2 additions & 15 deletions src/pages/blog/[category].astro
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
---
import BlogLayout from '@/layouts/BlogLayout.astro'
import { getCollection } from 'astro:content'
import BlogListSection from '@/components/blog/BlogListSection.astro'
import { BlogCategoryMapping, type BlogCategory } from '@/content/config'
import BlogCategoryNav from '@/components/blog/BlogCategoryNav.astro'
import IndexPage from './_IndexPage.astro'
export function getStaticPaths() {
return (Object.keys(BlogCategoryMapping) as BlogCategory[]).map(
Expand All @@ -15,16 +12,6 @@ export function getStaticPaths() {
}
const { category } = Astro.props
const blogEntries = (await getCollection('blogs')).filter(
({ data: { category: c } }) => c === category,
)
---

<BlogLayout title="記事一覧" description="メンバーのブログです。">
<main class="flex h-full flex-col">
<BlogListSection title="最新の記事一覧" blogs={blogEntries}>
<Fragment slot="nav"><BlogCategoryNav category={category} /></Fragment>
</BlogListSection>
</main>
</BlogLayout>
<IndexPage category={category} />
25 changes: 25 additions & 0 deletions src/pages/blog/_IndexPage.astro
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
import BlogLayout from '@/layouts/BlogLayout.astro'
import { getCollection } from 'astro:content'
import BlogListSection from '@/components/blog/BlogListSection.astro'
import type { BlogCategory } from '@/content/config'
import BlogCategoryNav from '@/components/blog/BlogCategoryNav.astro'
interface Props {
category: 'all' | BlogCategory
}
const { category } = Astro.props
const blogEntries = (await getCollection('blogs')).filter(
({ data: { category: c } }) => category === 'all' || c === category,
)
---

<BlogLayout title="記事一覧" description="メンバーのブログです。">
<main class="flex h-full flex-col">
<BlogListSection title="最新の記事一覧" blogs={blogEntries}>
<Fragment slot="nav"><BlogCategoryNav category={category} /></Fragment>
</BlogListSection>
</main>
</BlogLayout>
15 changes: 2 additions & 13 deletions src/pages/blog/index.astro
Original file line number Diff line number Diff line change
@@ -1,16 +1,5 @@
---
import BlogLayout from '@/layouts/BlogLayout.astro'
import { getCollection } from 'astro:content'
import BlogListSection from '@/components/blog/BlogListSection.astro'
import BlogCategoryNav from '@/components/blog/BlogCategoryNav.astro'
const blogEntries = await getCollection('blogs')
import IndexPage from './_IndexPage.astro'
---

<BlogLayout title="記事一覧" description="メンバーのブログです。">
<main class="flex h-full flex-col">
<BlogListSection title="最新の記事一覧" blogs={blogEntries}>
<Fragment slot="nav"><BlogCategoryNav category="all" /></Fragment>
</BlogListSection>
</main>
</BlogLayout>
<IndexPage category="all" />
4 changes: 3 additions & 1 deletion src/pages/blog/tags/[slug].astro
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ const ogpPath = (
format: 'png',
})
).src
const isShowAbout = tag.description || tag.links.length > 0
---

<BlogLayout
Expand All @@ -38,7 +40,7 @@ const ogpPath = (
<TagIcon slot="icon" tag={tag} size={tag.fullSizeImage ? 93 : 80} />
</BlogTitle>
<main class="flex h-full flex-col">
<TagAboutSection tag={tag} />
{isShowAbout && <TagAboutSection tag={tag} />}
<BlogListSection
title={`${tag.name} に関する記事`}
blogs={blogEntries.filter((b) => b.data.tags.some((t) => t.id === id))}
Expand Down
1 change: 1 addition & 0 deletions src/pages/blog/tags/index.astro
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import BlogLayout from '@/layouts/BlogLayout.astro'
import { getCollection } from 'astro:content'
import { getTagStatistics } from '@/content/_blog-statistics'
import TagListSection from '@/components/blog/tag/TagListSection.astro'
const tagEntries = await getCollection('tags')
const statistics = await getTagStatistics()
const tags = tagEntries
Expand Down

0 comments on commit 372c8c2

Please sign in to comment.