index.tsx
46 lines
| 1 | import classnames from 'classnames'; |
| 2 | import styles from './styles.module.scss'; |
| 3 | |
| 4 | |
| 5 | |
| 6 | /** |
| 7 | * @since 4.8.0 |
| 8 | */ |
| 9 | type GridProps = { |
| 10 | children: React.ReactNode; |
| 11 | ariaLabel: string; |
| 12 | }; |
| 13 | |
| 14 | /** |
| 15 | * @since 4.8.0 |
| 16 | */ |
| 17 | export default function Grid({children, ariaLabel}: GridProps) { |
| 18 | return ( |
| 19 | <div className={styles.container} role="group" aria-label={ariaLabel}> |
| 20 | {children} |
| 21 | </div> |
| 22 | ); |
| 23 | } |
| 24 | |
| 25 | /** |
| 26 | * @since 4.8.0 |
| 27 | */ |
| 28 | type GridCardProps = { |
| 29 | children: React.ReactNode; |
| 30 | heading: string; |
| 31 | headingId: string; |
| 32 | className?: string; |
| 33 | }; |
| 34 | |
| 35 | /** |
| 36 | * @since 4.8.0 |
| 37 | */ |
| 38 | export function GridCard({children, heading, headingId, className}: GridCardProps) { |
| 39 | return ( |
| 40 | <div className={classnames(styles.card, className)} role="region" aria-labelledby={`${headingId}-label`}> |
| 41 | <h3 id={headingId} className={styles.heading}>{heading}</h3> |
| 42 | {children} |
| 43 | </div> |
| 44 | ); |
| 45 | } |
| 46 |