diff options
| author | Armand Philippot <git@armandphilippot.com> | 2022-01-26 15:16:59 +0100 |
|---|---|---|
| committer | Armand Philippot <git@armandphilippot.com> | 2022-01-26 15:16:59 +0100 |
| commit | 5c3ea8b577e934237a5d03c477361763b167f57b (patch) | |
| tree | 02921d693f9a70bbeae3b911c8c54b296bacf2b4 /src/components/MDX/Gallery/Gallery.tsx | |
| parent | c18f2f8a9d189343db9740945196af46c903d2d9 (diff) | |
chore: add a Gallery component for MDX rendering
Diffstat (limited to 'src/components/MDX/Gallery/Gallery.tsx')
| -rw-r--r-- | src/components/MDX/Gallery/Gallery.tsx | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/components/MDX/Gallery/Gallery.tsx b/src/components/MDX/Gallery/Gallery.tsx new file mode 100644 index 0000000..561ec53 --- /dev/null +++ b/src/components/MDX/Gallery/Gallery.tsx @@ -0,0 +1,22 @@ +import { Children, ReactElement } from 'react'; +import styles from './Gallery.module.scss'; + +const Gallery = ({ + children, + columns = 2, +}: { + children: ReactElement; + columns: number; +}) => { + const columnClass = styles[`wrapper--${columns}-columns`]; + + return ( + <ul className={`${styles.wrapper} ${columnClass}`}> + {Children.map(children, (child) => { + return <li className={styles.item}>{child}</li>; + })} + </ul> + ); +}; + +export default Gallery; |
