mirror of
https://github.com/kremalicious/umami.git
synced 2024-11-16 02:05:04 +01:00
33 lines
740 B
JavaScript
33 lines
740 B
JavaScript
import React from 'react';
|
|
import classNames from 'classnames';
|
|
import Button from './Button';
|
|
import styles from './ButtonGroup.module.css';
|
|
|
|
export default function ButtonGroup({
|
|
items = [],
|
|
selectedItem,
|
|
className,
|
|
size,
|
|
icon,
|
|
onClick = () => {},
|
|
}) {
|
|
return (
|
|
<div className={classNames(styles.group, className)}>
|
|
{items.map(item => {
|
|
const { label, value } = item;
|
|
return (
|
|
<Button
|
|
key={value}
|
|
className={classNames(styles.button, { [styles.selected]: selectedItem === value })}
|
|
size={size}
|
|
icon={icon}
|
|
onClick={() => onClick(value)}
|
|
>
|
|
{label}
|
|
</Button>
|
|
);
|
|
})}
|
|
</div>
|
|
);
|
|
}
|