mirror of
https://github.com/kremalicious/umami.git
synced 2024-12-24 10:16:19 +01:00
30 lines
651 B
JavaScript
30 lines
651 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 => (
|
||
|
<Button
|
||
|
key={item}
|
||
|
className={classNames(styles.button, { [styles.selected]: selectedItem === item })}
|
||
|
size={size}
|
||
|
icon={icon}
|
||
|
onClick={() => onClick(item)}
|
||
|
>
|
||
|
{item}
|
||
|
</Button>
|
||
|
))}
|
||
|
</div>
|
||
|
);
|
||
|
}
|