diff --git a/packages/website/components/AuthorCard/index.tsx b/packages/website/components/AuthorCard/index.tsx index 9a1925221..340465401 100644 --- a/packages/website/components/AuthorCard/index.tsx +++ b/packages/website/components/AuthorCard/index.tsx @@ -1,16 +1,19 @@ +import Headroom from "headroom.js"; import Link from "next/link"; import { useContext, useEffect, useMemo } from "react"; -import Headroom from "headroom.js"; -import { SocialItem } from "../../api/getAllData"; + import SocialCard from "../SocialCard"; import ImageBoxFuture from "../ImageBoxFuture"; +import { type SocialItem } from "../../api/getAllData"; import { ThemeContext } from "../../utils/themeContext"; + export interface AuthorCardProps { author: string; desc: string; logo: string; logoDark: string; postNum: number; + // FIXME: This is a typo, should be corrected to `catalogNum` catelogNum: number; tagNum: number; enableComment?: "true" | "false"; @@ -23,22 +26,22 @@ export default function (props: { option: AuthorCardProps }) { const { theme } = useContext(ThemeContext); const logoUrl = useMemo(() => { - if ( - theme.includes("dark") && - props.option.logoDark && - props.option.logoDark != "" - ) { + if (theme.includes("dark") && props.option.logoDark) { return props.option.logoDark; } + return props.option.logo; }, [theme, props]); + useEffect(() => { const el = document.querySelector("#author-card"); + if (el) { const headroom = new Headroom(el, { classes: { - initial: `side-bar${props.option.showSubMenu == "true" ? "" : " no-submenu" - }`, + initial: `side-bar${ + props.option.showSubMenu == "true" ? "" : " no-submenu" + }`, pinned: "side-bar-pinned", unpinned: "side-bar-unpinned", top: "side-bar-top", @@ -48,6 +51,7 @@ export default function (props: { option: AuthorCardProps }) { headroom.init(); } }); + return (
@@ -92,7 +96,7 @@ export default function (props: { option: AuthorCardProps }) {
{props.option.tagNum}
-
+
标签