blob: b5bd9b5bb72e6fc0d1d53291f55d528952cf8a79 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
import { FC, ReactComponentElement } from 'react';
import { Column } from '../../atoms';
import styles from './columns.module.scss';
export type ColumnsProps = {
/**
* The columns.
*/
children: ReactComponentElement<typeof Column>[];
/**
* Set additional classnames to the columns wrapper.
*/
className?: string;
/**
* The number of columns.
*/
count: 2 | 3 | 4;
/**
* Should the columns be stacked on small devices? Default: true.
*/
responsive?: boolean;
};
/**
* Columns component.
*
* Render some Column components as columns.
*/
export const Columns: FC<ColumnsProps> = ({
children,
className = '',
count,
responsive = true,
}) => {
const countClass = `wrapper--${count}-columns`;
const responsiveClass = responsive
? `wrapper--responsive`
: 'wrapper--no-responsive';
const wrapperClass = `${styles.wrapper} ${styles[countClass]} ${styles[responsiveClass]} ${className}`;
return <div className={wrapperClass}>{children}</div>;
};
|