summaryrefslogtreecommitdiffstats
path: root/src/components/MDX/Gallery/Gallery.tsx
diff options
context:
space:
mode:
authorArmand Philippot <git@armandphilippot.com>2022-01-26 15:16:59 +0100
committerArmand Philippot <git@armandphilippot.com>2022-01-26 15:16:59 +0100
commit5c3ea8b577e934237a5d03c477361763b167f57b (patch)
tree02921d693f9a70bbeae3b911c8c54b296bacf2b4 /src/components/MDX/Gallery/Gallery.tsx
parentc18f2f8a9d189343db9740945196af46c903d2d9 (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.tsx22
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;