diff options
Diffstat (limited to 'src/components')
| -rw-r--r-- | src/components/BlockQuote.astro | 17 | ||||
| -rw-r--r-- | src/components/ExternalLink.astro | 15 | ||||
| -rw-r--r-- | src/components/Highlight.astro | 8 | ||||
| -rw-r--r-- | src/components/KaigirokuDougaLink.astro | 51 | ||||
| -rw-r--r-- | src/components/MessageBubble.astro | 17 | ||||
| -rw-r--r-- | src/components/starlight/Breadcrumbs.astro | 83 | ||||
| -rw-r--r-- | src/components/starlight/PageTitle.astro | 24 |
7 files changed, 215 insertions, 0 deletions
diff --git a/src/components/BlockQuote.astro b/src/components/BlockQuote.astro new file mode 100644 index 0000000..83a2409 --- /dev/null +++ b/src/components/BlockQuote.astro @@ -0,0 +1,17 @@ +--- +export interface Props { + refs?: string; + href?: string; +} +const { refs, href } = Astro.props; +--- +<blockquote class="qt"> + { + href ? ( + <header><cite><a href={href} rel="noopener noreferrer" target="_blank">{refs}</a></cite></header> + ) : refs ? ( + <header><cite>{refs}</cite></header> + ) : null + } + <slot /> +</blockquote> diff --git a/src/components/ExternalLink.astro b/src/components/ExternalLink.astro new file mode 100644 index 0000000..1068872 --- /dev/null +++ b/src/components/ExternalLink.astro @@ -0,0 +1,15 @@ +--- +export interface Props { + href?: string; +} +const { href } = Astro.props; +--- +{ + href ? ( + <a href={href} rel="noopener noreferrer" target="_blank"> + <slot /> + </a> + ) : ( + <><slot /></> + ) +} diff --git a/src/components/Highlight.astro b/src/components/Highlight.astro new file mode 100644 index 0000000..70d478a --- /dev/null +++ b/src/components/Highlight.astro @@ -0,0 +1,8 @@ +--- +export interface Props { + children: any; +} +--- +<span class="highlight-span"> + <slot /> +</span> diff --git a/src/components/KaigirokuDougaLink.astro b/src/components/KaigirokuDougaLink.astro new file mode 100644 index 0000000..7695860 --- /dev/null +++ b/src/components/KaigirokuDougaLink.astro @@ -0,0 +1,51 @@ +--- +export interface Props { + kaigirokuHref?: string; + dougaHref?: string; +} +const { kaigirokuHref, dougaHref } = Astro.props; +const mada = kaigirokuHref ? '' : '(まだ公開されていません)'; +--- +<div id="kaigiroku" class="kaigiroku-links"> + {kaigirokuHref ? ( + <a href={kaigirokuHref} rel="noopener noreferrer" target="_blank" class="kgk-link"> + 📄 会議録 + </a> + ) : ( + <span class="kgk-link kgk-pending">📄 会議録{mada}</span> + )} + {dougaHref && ( + <a href={dougaHref} rel="noopener noreferrer" target="_blank" class="kgk-link"> + 🎞️ 動画 + </a> + )} +</div> + +<style> + .kaigiroku-links { + display: flex; + gap: 0.5rem; + margin-bottom: 0.25rem; + flex-wrap: wrap; + } + .kgk-link { + display: inline-flex; + align-items: center; + gap: 0.3rem; + padding: 0.3rem 0.75rem; + border-radius: 100px; + font-size: 0.85em; + font-weight: 500; + text-decoration: none; + background: var(--sl-color-accent-low); + color: var(--sl-color-accent-high); + transition: background 0.15s; + } + .kgk-link:hover { + background: var(--sl-color-accent); + color: #fff; + } + .kgk-pending { + opacity: 0.5; + } +</style> diff --git a/src/components/MessageBubble.astro b/src/components/MessageBubble.astro new file mode 100644 index 0000000..74f9927 --- /dev/null +++ b/src/components/MessageBubble.astro @@ -0,0 +1,17 @@ +--- +export interface Props { + speaker: string; + align?: 'left' | 'right'; + id?: string; + className?: string; +} +const { speaker, align = 'right', id, className = '' } = Astro.props; +--- +<div + class:list={['bln', align === 'left' ? 'bleft' : 'bright', className]} + data-speaker={speaker} + {id ? `id=${id}` : ''} +> + <span class="tail-outer"></span> + <slot /> +</div> diff --git a/src/components/starlight/Breadcrumbs.astro b/src/components/starlight/Breadcrumbs.astro new file mode 100644 index 0000000..3ab3281 --- /dev/null +++ b/src/components/starlight/Breadcrumbs.astro @@ -0,0 +1,83 @@ +--- +import config from 'virtual:starlight/user-config'; + +const route = Astro.locals.starlightRoute; +const base = config.base || ''; +const slug = route.entry?.slug || route.id || ''; +const parts = slug.split('/').filter(Boolean); + +// Build breadcrumb trail +const breadcrumbs: { label: string; href: string }[] = []; +let currentPath = ''; +for (let i = 0; i < parts.length; i++) { + currentPath += '/' + parts[i]; + breadcrumbs.push({ + label: labelMap(parts[i]) || parts[i], + href: base + currentPath + '/', + }); +} + +// Replace last breadcrumb label with page title +if (breadcrumbs.length > 0) { + breadcrumbs[breadcrumbs.length - 1].label = route.entry?.data?.title || breadcrumbs[breadcrumbs.length - 1].label; +} + +function labelMap(segment: string): string | null { + const map: Record<string, string> = { + 'ippan-situmon': '一般質問', + 'gian-tou': '議案等', + 'hattatu': '発達関連', + 'blog': 'ふらっとブログ', + 'r7d': '令和7年度', 'r6d': '令和6年度', 'r5d': '令和5年度', 'r4d': '令和4年度', + 'r3d': '令和3年度', 'r2d': '令和2年度', 'r1d': '令和元年度', + '6gatu': '6月定例会', '9gatu': '9月定例会', + '12gatu': '12月定例会', '3gatu': '3月定例会', + }; + return map[segment] || null; +} +--- + +{breadcrumbs.length > 0 && ( + <nav class="breadcrumbs" aria-label="パンくず"> + <ol> + <li><a href="/">ホーム</a></li> + {breadcrumbs.map((crumb, i) => ( + <li> + {i < breadcrumbs.length - 1 ? ( + <a href={crumb.href}>{crumb.label}</a> + ) : ( + <span>{crumb.label}</span> + )} + </li> + ))} + </ol> + </nav> +)} + +<style> + .breadcrumbs ol { + list-style: none; + padding: 0; + margin: 0 0 0.5rem; + font-size: 0.85rem; + color: var(--sl-color-gray-3); + line-height: 1.6; + } + .breadcrumbs li { + display: inline; + } + .breadcrumbs li:not(:last-child)::after { + content: '›'; + margin: 0 0.25rem; + } + .breadcrumbs a { + text-decoration: none; + color: var(--sl-color-gray-3); + } + .breadcrumbs a:hover { + color: var(--sl-color-accent); + } + .breadcrumbs span { + color: var(--sl-color-text); + } +</style> diff --git a/src/components/starlight/PageTitle.astro b/src/components/starlight/PageTitle.astro new file mode 100644 index 0000000..352e1c3 --- /dev/null +++ b/src/components/starlight/PageTitle.astro @@ -0,0 +1,24 @@ +--- +import Breadcrumbs from './Breadcrumbs.astro'; +--- + +{Astro.url.pathname !== "/" && ( + <> + <div id="_top"> + <Breadcrumbs /> + </div> + <h1>{Astro.locals.starlightRoute.entry.data.title}</h1> + </> +)} + +<style> + @layer starlight.core { + h1 { + margin-top: 1rem; + font-size: var(--sl-text-h1); + line-height: var(--sl-line-height-headings); + font-weight: 600; + color: var(--sl-color-white); + } + } +</style> |
