microsoft/hve-core
Publicmirrored fromhttps://github.com/microsoft/hve-coreAvailable
docs/docusaurus/src/components/HeroSection/index.tsx
44lines · modecode
| 1 | import React from 'react'; |
| 2 | import Link from '@docusaurus/Link'; |
| 3 | import styles from './styles.module.css'; |
| 4 | |
| 5 | interface CtaLink { |
| 6 | label: string; |
| 7 | href: string; |
| 8 | primary?: boolean; |
| 9 | } |
| 10 | |
| 11 | interface HeroSectionProps { |
| 12 | title: string; |
| 13 | subtitle: string; |
| 14 | cta?: CtaLink[]; |
| 15 | } |
| 16 | |
| 17 | export default function HeroSection({ |
| 18 | title, |
| 19 | subtitle, |
| 20 | cta, |
| 21 | }: HeroSectionProps): React.ReactElement { |
| 22 | return ( |
| 23 | <header className={styles.hero}> |
| 24 | <div className={styles.heroPattern} /> |
| 25 | <div className={styles.heroContent}> |
| 26 | <h1 className={styles.heroTitle}>{title}</h1> |
| 27 | <p className={styles.heroSubtitle}>{subtitle}</p> |
| 28 | {cta && cta.length > 0 && ( |
| 29 | <div className={styles.heroCta}> |
| 30 | {cta.map((link) => ( |
| 31 | <Link |
| 32 | key={link.href} |
| 33 | to={link.href} |
| 34 | className={link.primary ? styles.heroCtaPrimary : styles.heroCtaSecondary} |
| 35 | > |
| 36 | {link.label} |
| 37 | </Link> |
| 38 | ))} |
| 39 | </div> |
| 40 | )} |
| 41 | </div> |
| 42 | </header> |
| 43 | ); |
| 44 | } |