Skip to content

Commit

Permalink
feat: support multiple sections in about page
Browse files Browse the repository at this point in the history
  • Loading branch information
SnowballXueQiu committed Aug 16, 2024
1 parent 3f29c33 commit 06dbdb9
Show file tree
Hide file tree
Showing 5 changed files with 82 additions and 38 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ interface DeveloperCardProps {
logo: string;
}

export default function DeveloperCard({
export default function PeopleCard({
name,
badges = [],
links,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,27 +84,5 @@
}
],
"logo": "https://user.klpbbs.com/data/avatar/000/00/00/01_avatar_big.jpg"
},
{
"name": "苏晴晴",
"badges": ["题目编写"],
"links": [
{
"name": "苦力怕论坛",
"url": "https://klpbbs.com/?158683"
}
],
"logo": "https://user.klpbbs.com/data/avatar/000/15/86/83_avatar_big.jpg"
},
{
"name": "水稻本尊",
"badges": ["题目编写"],
"links": [
{
"name": "苦力怕论坛",
"url": "https://klpbbs.com/?14351"
}
],
"logo": "https://user.klpbbs.com/data/avatar/000/01/43/51_avatar_big.jpg"
}
]
24 changes: 24 additions & 0 deletions app/(root)/about/data/examiners.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
[
{
"name": "苏晴晴",
"badges": ["题目编写"],
"links": [
{
"name": "苦力怕论坛",
"url": "https://klpbbs.com/?158683"
}
],
"logo": "https://user.klpbbs.com/data/avatar/000/15/86/83_avatar_big.jpg"
},
{
"name": "水稻本尊",
"badges": ["题目编写"],
"links": [
{
"name": "苦力怕论坛",
"url": "https://klpbbs.com/?14351"
}
],
"logo": "https://user.klpbbs.com/data/avatar/000/01/43/51_avatar_big.jpg"
}
]
24 changes: 24 additions & 0 deletions app/(root)/about/data/organizations.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
[
{
"name": "瀚海工艺",
"badges": [],
"links": [
{
"name": "GitHub",
"url": "https://github.com/TeamVastsea"
}
],
"logo": "https://s2.loli.net/2024/08/17/FKhUDT5RrikdPuA.png"
},
{
"name": "苦力怕论坛",
"badges": [],
"links": [
{
"name": "官方网站",
"url": "https://klpbbs.com/"
}
],
"logo": "https://klpbbs.com/favicon.ico"
}
]
48 changes: 33 additions & 15 deletions app/(root)/about/page.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
'use client';

import { useState } from 'react';
import { Button, Center, Divider, Group, Modal, Stack, Text, Title, Container } from '@mantine/core';
import { Button, Center, Divider, Group, Modal, Stack, Text, Title, Container, Paper } from '@mantine/core';
import { IconInfoCircle } from '@tabler/icons-react';
import { useDisclosure } from '@mantine/hooks';
import developerList from './data/data.json';
import DeveloperCard from './components/DeveloperCard';
import developerList from './data/developers.json';
import examinerList from './data/examiners.json';
import organizationList from './data/organizations.json';
import DeveloperCard from './components/PeopleCard';

interface DeveloperListProps {
name: string;
Expand All @@ -26,32 +28,48 @@ export default function AboutPage() {
open();
};

return (
<Center style={{ paddingTop: '2rem' }}>
<Container size="md">
const renderSection = (title: string, list: DeveloperListProps[]) => (
<Center>
<Paper shadow="sm" radius="lg" p="xl" withBorder style={{ minWidth: 350 }}>
<Stack>
<Center>
<Title>关于我们</Title>
<Title order={2}>{title}</Title>
</Center>
<Stack gap="md">
<Center>
<Text>这里是我们全部的开发人员</Text>
</Center>
<Center>
<Text fw={700}>(排名不分先后)</Text>
</Center>
{developerList.map((developer, index) => (
{list.map((developer, index) => (
<Stack key={index}>
<Group style={{ width: '100%' }}>
<Text ta="left" style={{ flexGrow: 1 }}>{developer.name}</Text>
<Button variant="subtle" onClick={() => handleDeveloperClick(developer)}>
<IconInfoCircle size={20} />
&nbsp;查看详情
</Button>
</Group>
{index < developerList.length - 1 && <Divider />}
{index < list.length - 1 && <Divider />}
</Stack>
))}
</Stack>
</Stack>
</Paper>
</Center>
);

return (
<Center style={{ paddingTop: '2rem', paddingBottom: '1rem' }}>
<Container size="md" style={{ paddingBottom: '1rem' }}>
<Center>
<Title>关于我们</Title>
</Center>
<Center>
<Text fw={700}>(排名不分先后)</Text>
</Center>

<Divider my="lg" size="xl" />

<Stack>
{renderSection('🔧 开发', developerList)}
{renderSection('✍️ 题目编写', examinerList)}
{renderSection('🏢 组织', organizationList)}

{selectedDeveloper && (
<Modal opened={opened} onClose={close} title="详细信息">
Expand Down

0 comments on commit 06dbdb9

Please sign in to comment.