|
| 1 | +import { FC } from 'react'; |
| 2 | +import { Col, Container, Row } from 'react-bootstrap'; |
| 3 | + |
| 4 | +import { HackathonHeroAction } from './HackathonHero'; |
| 5 | +import styles from './HackathonActionHub.module.less'; |
| 6 | + |
| 7 | +export interface HackathonActionHubEntry { |
| 8 | + count: number; |
| 9 | + description: string; |
| 10 | + eyebrow: string; |
| 11 | + links: HackathonHeroAction[]; |
| 12 | + title: string; |
| 13 | +} |
| 14 | + |
| 15 | +export interface HackathonActionHubProps { |
| 16 | + entries: HackathonActionHubEntry[]; |
| 17 | + facts: string[]; |
| 18 | + primaryAction?: HackathonHeroAction; |
| 19 | + primaryDescription: string; |
| 20 | + primaryTitle: string; |
| 21 | + secondaryAction: HackathonHeroAction; |
| 22 | + subtitle: string; |
| 23 | + title: string; |
| 24 | +} |
| 25 | + |
| 26 | +const ActionHubLink: FC<{ action: HackathonHeroAction; variant: 'ghost' | 'primary' }> = ({ |
| 27 | + action, |
| 28 | + variant, |
| 29 | +}) => ( |
| 30 | + <a |
| 31 | + className={variant === 'primary' ? styles.actionButton : styles.actionButtonGhost} |
| 32 | + href={action.href} |
| 33 | + {...(action.external && { target: '_blank', rel: 'noreferrer' })} |
| 34 | + > |
| 35 | + {action.label} |
| 36 | + </a> |
| 37 | +); |
| 38 | + |
| 39 | +const ActionEntryCard: FC<{ entry: HackathonActionHubEntry; step: string }> = ({ entry, step }) => ( |
| 40 | + <article className={styles.entryCard}> |
| 41 | + <span className={styles.entryStep}> |
| 42 | + {step} · {entry.eyebrow} |
| 43 | + </span> |
| 44 | + <h4>{entry.title}</h4> |
| 45 | + <p>{entry.description}</p> |
| 46 | + |
| 47 | + <div className={styles.entryMetaRow}> |
| 48 | + <span className={styles.entryMeta}>{entry.count}</span> |
| 49 | + <span className={styles.entryMeta}>{entry.eyebrow}</span> |
| 50 | + </div> |
| 51 | + |
| 52 | + <nav className={styles.entryLinks} aria-label={entry.title}> |
| 53 | + {entry.links.map(link => ( |
| 54 | + <a |
| 55 | + key={`${link.label}-${link.href}`} |
| 56 | + className={styles.entryLink} |
| 57 | + href={link.href} |
| 58 | + {...(link.external && { target: '_blank', rel: 'noreferrer' })} |
| 59 | + > |
| 60 | + {link.label} |
| 61 | + </a> |
| 62 | + ))} |
| 63 | + </nav> |
| 64 | + </article> |
| 65 | +); |
| 66 | + |
| 67 | +export const HackathonActionHub: FC<HackathonActionHubProps> = ({ |
| 68 | + entries, |
| 69 | + facts, |
| 70 | + primaryAction, |
| 71 | + primaryDescription, |
| 72 | + primaryTitle, |
| 73 | + secondaryAction, |
| 74 | + subtitle, |
| 75 | + title, |
| 76 | +}) => ( |
| 77 | + <section id="entry-hub" className={styles.section}> |
| 78 | + <Container> |
| 79 | + <div className={styles.registerWrap}> |
| 80 | + <article className={styles.registerCard}> |
| 81 | + <div className={styles.registerCardInner}> |
| 82 | + <p className={styles.regEyebrow}>{title}</p> |
| 83 | + <h2 className={styles.regTitle}>{primaryTitle}</h2> |
| 84 | + <p className={styles.regDesc}>{primaryDescription}</p> |
| 85 | + |
| 86 | + <nav className={styles.regActions} aria-label={title}> |
| 87 | + {primaryAction && <ActionHubLink action={primaryAction} variant="primary" />} |
| 88 | + <ActionHubLink action={secondaryAction} variant="ghost" /> |
| 89 | + </nav> |
| 90 | + |
| 91 | + <ul className={`list-unstyled ${styles.regFacts}`}> |
| 92 | + {facts.map(fact => ( |
| 93 | + <li key={fact}>{fact}</li> |
| 94 | + ))} |
| 95 | + </ul> |
| 96 | + </div> |
| 97 | + </article> |
| 98 | + |
| 99 | + <div className={styles.entryHub}> |
| 100 | + <header className={styles.entryHubHead}> |
| 101 | + <p className={styles.entryEyebrow}>{subtitle}</p> |
| 102 | + <h3 className={styles.entryTitle}>{title}</h3> |
| 103 | + </header> |
| 104 | + |
| 105 | + <Row as="ol" className="list-unstyled g-3 mb-0"> |
| 106 | + {entries.map((entry, index) => ( |
| 107 | + <Col as="li" key={entry.title} md={6}> |
| 108 | + <ActionEntryCard entry={entry} step={String(index + 1).padStart(2, '0')} /> |
| 109 | + </Col> |
| 110 | + ))} |
| 111 | + </Row> |
| 112 | + </div> |
| 113 | + </div> |
| 114 | + </Container> |
| 115 | + </section> |
| 116 | +); |
0 commit comments