|
| 1 | +import type { FC } from 'react'; |
| 2 | +import { Badge, Button, Card, Col, Container, Row } from 'react-bootstrap'; |
| 3 | + |
| 4 | +import type { StaticHackathonProfile } from '../../constants/staticHackathons'; |
| 5 | +import styles from '../../styles/Hackathon.module.less'; |
| 6 | + |
| 7 | +const AgendaTypeLabel: Record<StaticHackathonProfile['agenda'][number]['type'], string> = { |
| 8 | + enrollment: '报名', |
| 9 | + formation: '组队', |
| 10 | + competition: '比赛', |
| 11 | + evaluation: '评审', |
| 12 | + break: '展示', |
| 13 | +}; |
| 14 | + |
| 15 | +export interface StaticHackathonDetailProps { |
| 16 | + profile: StaticHackathonProfile; |
| 17 | +} |
| 18 | + |
| 19 | +export const StaticHackathonDetail: FC<StaticHackathonDetailProps> = ({ profile }) => ( |
| 20 | + <> |
| 21 | + <section className={styles.hero}> |
| 22 | + <Container> |
| 23 | + <div className="text-center mb-3"> |
| 24 | + <Badge bg="light" text="dark"> |
| 25 | + {profile.theme} |
| 26 | + </Badge> |
| 27 | + </div> |
| 28 | + <h1 className={`text-center ${styles.title}`}>{profile.name}</h1> |
| 29 | + <p className={`text-center ${styles.description}`}>{profile.summary}</p> |
| 30 | + |
| 31 | + <Row className="mt-4 justify-content-center"> |
| 32 | + <Col md={4}> |
| 33 | + <Card className={styles.infoCard}> |
| 34 | + <Card.Body> |
| 35 | + <h5 className="text-white mb-2">📍 活动形式</h5> |
| 36 | + <p className="text-white-50 mb-0">{profile.location}</p> |
| 37 | + </Card.Body> |
| 38 | + </Card> |
| 39 | + </Col> |
| 40 | + <Col md={4}> |
| 41 | + <Card className={styles.infoCard}> |
| 42 | + <Card.Body> |
| 43 | + <h5 className="text-white mb-2">⏰ 活动时间</h5> |
| 44 | + <p className="text-white-50 mb-0">{profile.timeline}</p> |
| 45 | + </Card.Body> |
| 46 | + </Card> |
| 47 | + </Col> |
| 48 | + </Row> |
| 49 | + |
| 50 | + <Row className="mt-4 g-3 justify-content-center"> |
| 51 | + {profile.entryLinks.slice(0, 2).map(({ href, label }) => ( |
| 52 | + <Col key={label} md="auto"> |
| 53 | + <Button href={href} target="_blank" rel="noreferrer" size="lg"> |
| 54 | + {label} |
| 55 | + </Button> |
| 56 | + </Col> |
| 57 | + ))} |
| 58 | + </Row> |
| 59 | + </Container> |
| 60 | + </section> |
| 61 | + |
| 62 | + <Container className="my-5"> |
| 63 | + <section className={styles.section}> |
| 64 | + <h2 className={styles.sectionTitle}>🔗 报名与入口</h2> |
| 65 | + <Row className="mt-4 g-3" md={2} xl={3}> |
| 66 | + {profile.entryLinks.map(({ href, label, note }) => ( |
| 67 | + <Col key={label}> |
| 68 | + <Card className={styles.darkCard} body> |
| 69 | + <h3 className="h5 text-white">{label}</h3> |
| 70 | + <p className="text-white-50 mb-3">{note}</p> |
| 71 | + <Button href={href} target="_blank" rel="noreferrer" variant="light"> |
| 72 | + 打开链接 |
| 73 | + </Button> |
| 74 | + </Card> |
| 75 | + </Col> |
| 76 | + ))} |
| 77 | + </Row> |
| 78 | + </section> |
| 79 | + |
| 80 | + <section className={styles.section}> |
| 81 | + <h2 className={styles.sectionTitle}>📅 活动日程</h2> |
| 82 | + <ol className="list-unstyled mt-4"> |
| 83 | + {profile.agenda.map(({ endedAt, name, startedAt, summary, type }) => ( |
| 84 | + <li key={`${name}-${startedAt}`} className={`${styles.agendaItem} ${styles[type]}`}> |
| 85 | + <h3 className="h5 text-white mb-2">{name}</h3> |
| 86 | + <p className="text-white-50 small mb-2">{summary}</p> |
| 87 | + <div className="d-flex justify-content-between align-items-center gap-3 flex-wrap"> |
| 88 | + <Badge bg="dark">{AgendaTypeLabel[type]}</Badge> |
| 89 | + <div className="text-white-50 small"> |
| 90 | + {startedAt} - {endedAt} |
| 91 | + </div> |
| 92 | + </div> |
| 93 | + </li> |
| 94 | + ))} |
| 95 | + </ol> |
| 96 | + </section> |
| 97 | + |
| 98 | + <section className={`${styles.section} ${styles.prizeSection}`}> |
| 99 | + <h2 className={styles.sectionTitle}>🏆 奖项设置</h2> |
| 100 | + <Row className="mt-4 g-3" md={2} xl={3}> |
| 101 | + {profile.awards.map(({ name, quota, summary }) => ( |
| 102 | + <Col key={name}> |
| 103 | + <Card className={styles.lightCard} body> |
| 104 | + <div className="d-flex justify-content-between align-items-start gap-3"> |
| 105 | + <h3 className="h5 mb-2">{name}</h3> |
| 106 | + <Badge bg="dark">{quota}</Badge> |
| 107 | + </div> |
| 108 | + <p className="mb-0">{summary}</p> |
| 109 | + </Card> |
| 110 | + </Col> |
| 111 | + ))} |
| 112 | + </Row> |
| 113 | + </section> |
| 114 | + |
| 115 | + <section className={styles.section}> |
| 116 | + <h2 className={styles.sectionTitle}>🧾 参赛说明</h2> |
| 117 | + <Row className="mt-4 g-3" md={2}> |
| 118 | + {profile.notes.map(note => ( |
| 119 | + <Col key={note}> |
| 120 | + <Card className={styles.darkCard} body> |
| 121 | + <p className="text-white-50 mb-0">{note}</p> |
| 122 | + </Card> |
| 123 | + </Col> |
| 124 | + ))} |
| 125 | + </Row> |
| 126 | + </section> |
| 127 | + |
| 128 | + <section className={styles.section}> |
| 129 | + <h2 className={styles.sectionTitle}>❓ FAQ</h2> |
| 130 | + <Row className="mt-4 g-3" md={2}> |
| 131 | + {profile.faq.map(({ answer, question }) => ( |
| 132 | + <Col key={question}> |
| 133 | + <Card className={styles.darkCard} body> |
| 134 | + <h3 className="h5 text-white">{question}</h3> |
| 135 | + <p className="text-white-50 mb-0">{answer}</p> |
| 136 | + </Card> |
| 137 | + </Col> |
| 138 | + ))} |
| 139 | + </Row> |
| 140 | + </section> |
| 141 | + </Container> |
| 142 | + </> |
| 143 | +); |
0 commit comments