22301014 | 356527a | 2025-06-09 17:46:56 +0800 | [diff] [blame^] | 1 | import React from 'react'; |
| 2 | import { Row, Col, Typography, Divider } from 'antd'; |
| 3 | import type { CategoryProps } from './types'; |
| 4 | import WorkCard from './WorkCard'; |
| 5 | |
| 6 | const { Title } = Typography; |
| 7 | |
| 8 | const Category: React.FC<CategoryProps> = ({ section, artworks }) => { |
| 9 | // 如果没有作品,不渲染该分区 |
| 10 | if (artworks.length === 0) { |
| 11 | return null; |
| 12 | } |
| 13 | |
| 14 | return ( |
| 15 | <div style={{ marginBottom: '48px' }}> |
| 16 | <Title level={2} style={{ marginBottom: '24px', color: '#1890ff' }}> |
| 17 | {section.name} |
| 18 | </Title> |
| 19 | <Divider style={{ margin: '16px 0 24px 0' }} /> |
| 20 | |
| 21 | <Row gutter={[16, 16]}> |
| 22 | {artworks.map((artwork) => ( |
| 23 | <Col |
| 24 | key={artwork.id} |
| 25 | xs={24} |
| 26 | sm={12} |
| 27 | md={8} |
| 28 | lg={6} |
| 29 | xl={6} |
| 30 | > |
| 31 | <WorkCard artwork={artwork} /> |
| 32 | </Col> |
| 33 | ))} |
| 34 | </Row> |
| 35 | </div> |
| 36 | ); |
| 37 | }; |
| 38 | |
| 39 | export default Category; |