refactor: remove unused props from components and improve error handling in about page (#385)

This commit is contained in:
Katsuyuki Karasawa
2025-04-08 22:44:52 +09:00
committed by GitHub
parent c8142d0ac5
commit 7ea2f7f40f
8 changed files with 11 additions and 12 deletions

View File

@@ -10,7 +10,7 @@ interface Props {
tags?: string[]
categories?: string[]
}
const { keyword, tags, categories } = Astro.props
const { tags, categories } = Astro.props
let posts = await getSortedPosts()

View File

@@ -5,7 +5,7 @@ interface Props {
href?: string
label?: string
}
const { size, dot, href, label }: Props = Astro.props
const { dot, href, label }: Props = Astro.props
---
<a href={href} aria-label={label} class="btn-regular h-8 text-sm px-3 rounded-lg">
{dot && <div class="h-1 w-1 bg-[var(--btn-content)] dark:bg-[var(--card-bg)] transition rounded-md mr-2"></div>}

View File

@@ -12,7 +12,7 @@ interface Props {
class: string
}
const { title, slug, pubDate } = Astro.props
const { title, pubDate } = Astro.props
const className = Astro.props.class
const profileConf = profileConfig
const licenseConf = licenseConfig

View File

@@ -3,7 +3,6 @@ import Profile from './Profile.astro'
import Tag from './Tags.astro'
import Categories from './Categories.astro'
import type { MarkdownHeading } from 'astro'
import TOC from './TOC.astro'
interface Props {
class? : string
@@ -11,7 +10,6 @@ interface Props {
}
const className = Astro.props.class
const headings = Astro.props.headings
---
<div id="sidebar" class:list={[className, "w-full"]}>

View File

@@ -10,7 +10,6 @@ interface Props {
class?: string
style?: string
}
const props = Astro.props
const { id, name, isCollapsed, collapsedHeight, style } = Astro.props
const className = Astro.props.class
---

View File

@@ -208,9 +208,7 @@ import {
BANNER_HEIGHT,
BANNER_HEIGHT_HOME,
BANNER_HEIGHT_EXTEND,
MAIN_PANEL_OVERLAPS_BANNER_HEIGHT,
PAGE_WIDTH
} from "../constants/constants";
MAIN_PANEL_OVERLAPS_BANNER_HEIGHT} from "../constants/constants";
/* Preload fonts */
// (async function() {
@@ -405,7 +403,7 @@ const setup = () => {
heightExtend.classList.remove('hidden')
}
});
window.swup.hooks.on('visit:end', (visit: {to: {url: string}}) => {
window.swup.hooks.on('visit:end', (_visit: {to: {url: string}}) => {
setTimeout(() => {
const heightExtend = document.getElementById('page-height-extend')
if (heightExtend) {

View File

@@ -6,10 +6,15 @@ import { getEntry } from 'astro:content'
import { i18n } from '../i18n/translation'
import I18nKey from '../i18n/i18nKey'
import Markdown from '@components/misc/Markdown.astro'
import { render } from 'astro:content'
const aboutPost = await getEntry('spec', 'about')
const { Content } = await aboutPost.render()
if (!aboutPost) {
throw new Error("About page content not found");
}
const { Content } = await render(aboutPost)
---
<MainGridLayout title={i18n(I18nKey.about)} description={i18n(I18nKey.about)}>
<div class="flex w-full rounded-[var(--radius-large)] overflow-hidden relative min-h-32">

View File

@@ -1,6 +1,5 @@
---
import path from 'node:path'
import { getCollection } from 'astro:content'
import License from '@components/misc/License.astro'
import Markdown from '@components/misc/Markdown.astro'
import I18nKey from '@i18n/i18nKey'