diff --git a/src/components/Member/index.tsx b/src/components/Member/index.tsx index 1abfbad..07d54b6 100644 --- a/src/components/Member/index.tsx +++ b/src/components/Member/index.tsx @@ -2,11 +2,20 @@ import { Avatar } from "@/components/ui/avatar" import { memberData } from "@/components/Member/memberData"; import GithubIcon from '@site/static/img/github.svg'; import React, { useState, useMemo, useEffect } from 'react'; +import './styles.module.css'; export default function Component() { const data = memberData const [activeYear, setActiveYear] = useState(Object.keys(data)[0]); // 默认为第一个年份 const [activeFocus, setActiveFocus] = useState('All'); // 默认选中所有 focus + const [isExpanded, setIsExpanded] = useState(false); // 默认不展开年份选择 + + const imgPrefix = "https://img.w2fzu.com/member/" + const githubPrefix = "https://github.com/" + const visibleYearsCount = 3; // 可见年份数量 + + const sortedYears = Object.keys(data).sort((a, b) => b.localeCompare(a)); + const displayedYears = isExpanded ? sortedYears : sortedYears.slice(0, visibleYearsCount); // 我们创建一个 state 来存储 LazyLoad 组件 const [LazyLoad, setLazyLoad] = useState(null); @@ -51,22 +60,29 @@ export default function Component() { return (
注:方向按成为正式成员时的聚焦方向归类,有多个方向以优先级最高的方向作为分类依据
{/* Focus 选择 */}{member.major}
{member.github !== "null" && (