Skip to content

Commit

Permalink
タグ検索を追加
Browse files Browse the repository at this point in the history
  • Loading branch information
miyaji255 committed Dec 29, 2023
1 parent e4f563d commit 4b65487
Show file tree
Hide file tree
Showing 23 changed files with 506 additions and 77 deletions.
3 changes: 2 additions & 1 deletion astro.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import tailwind from '@astrojs/tailwind'
import sitemap from '@astrojs/sitemap'
import mdx from '@astrojs/mdx'
import remarkLinkCard from 'remark-link-card'
import preact from '@astrojs/preact'

const { SITE_URL } = loadEnv(process.env.NODE_ENV!, process.cwd(), '')

Expand Down Expand Up @@ -36,5 +37,5 @@ export default defineConfig({
markdown: {
remarkPlugins: [remarkLinkCard],
},
integrations: [tailwind(), sitemap(), mdx()],
integrations: [tailwind(), sitemap(), mdx(), preact()],
})
167 changes: 167 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,13 @@
"dependencies": {
"@astrojs/check": "^0.3.1",
"@astrojs/mdx": "^2.0.1",
"@astrojs/preact": "^3.0.1",
"@astrojs/sitemap": "^3.0.3",
"@astrojs/tailwind": "^5.0.3",
"@tailwindcss/typography": "^0.5.10",
"astro": "^4.0.4",
"polished": "^4.2.2",
"preact": "^10.19.3",
"remark-link-card": "^1.3.1",
"satori": "^0.10.11",
"sharp": "^0.33.0",
Expand Down
11 changes: 11 additions & 0 deletions src/assets/icons/search.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 16 additions & 6 deletions src/components/blog/BlogListSection.astro
Original file line number Diff line number Diff line change
@@ -1,17 +1,27 @@
---
import type { CollectionEntry } from 'astro:content'
import BlogList from './BlogList.astro'
import Section from '../common/Section.astro'
import Section from '@/components/common/Section.astro'
interface Props {
title: string
title?: string
blogs: CollectionEntry<'blogs'>[]
}
const { title, blogs } = Astro.props
---

<Section background="secondary">
<Fragment slot="title">{title}</Fragment>
<BlogList blogs={blogs} />
</Section>
<Fragment>
{
title ? (
<Section background="secondary">
<Fragment slot="title">{title}</Fragment>
<BlogList blogs={blogs} />
</Section>
) : (
<Section background="secondary">
<BlogList blogs={blogs} />
</Section>
)
}
</Fragment>
48 changes: 48 additions & 0 deletions src/components/blog/ListViewTab.astro
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
---
interface Props {
current: Item['path']
}
interface Item {
path: '/blog/' | '/blog/tags/'
text: string
}
const items: Item[] = [
{
path: '/blog/',
text: 'ブログ一覧',
},
{
path: '/blog/tags/',
text: 'タグ一覧',
},
]
const { current } = Astro.props
---

<div class="bg-dot bg-dot-white flex justify-center">
<div class="w-full max-w-padded-container">
<ul class="flex gap-2 px-8 pt-3">
{
items.map((item) => (
<li class:list={[]}>
<a
class:list={[
'whitespace-nowrap rounded-t-xl border-x-2 border-t-2 border-secondary px-2 py-1',
{
'bg-white': item.path !== current,
'bg-secondary': item.path === current,
},
]}
href={item.path}
>
{item.text}
</a>
</li>
))
}
</ul>
</div>
</div>
2 changes: 1 addition & 1 deletion src/components/blog/author/AuthorAboutSection.astro
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
import type { CollectionEntry } from 'astro:content'
import Section from '../../common/Section.astro'
import Section from '@/components/common/Section.astro'
import InlineLink from '@/components/common/InlineLink.astro'
interface Props {
Expand Down
20 changes: 20 additions & 0 deletions src/components/blog/icon/TagIcon.preact.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import type { ClientTag } from '@/content/config'

interface Props {
tag: Pick<ClientTag, 'name' | 'image' | 'fullSizeImage'>

size: number
fullSizeImage?: boolean
}

export default function TagIcon({ tag, size }: Props) {
return (
<img
src={tag.image}
alt={`${tag.name} のアイコン`}
class={`aspect-square ${tag.fullSizeImage ? 'rounded-full' : ''}`}
width={size}
height={size}
/>
)
}
2 changes: 1 addition & 1 deletion src/components/blog/tag/TagAboutSection.astro
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
import type { CollectionEntry } from 'astro:content'
import Section from '../../common/Section.astro'
import Section from '@/components/common/Section.astro'
import InlineLink from '@/components/common/InlineLink.astro'
interface Props {
Expand Down
Loading

0 comments on commit 4b65487

Please sign in to comment.