| 1 |
/** |
| 2 |
* WordPress dependencies |
| 3 |
*/ |
| 4 |
const { ButtonGroup, Button } = wp.components; |
| 5 |
|
| 6 |
const UnitControl = ({ selectedUnit, unitTypes, onClick }) => ( |
| 7 |
<ButtonGroup className="eb-unit-control-btn-group"> |
| 8 |
{unitTypes.map((unit) => ( |
| 9 |
<Button |
| 10 |
key={unit.value} |
| 11 |
className={`eb-unit-control-btn ${ |
| 12 |
unit.value === selectedUnit && "eb-unit-active" |
| 13 |
}`} |
| 14 |
isSmall |
| 15 |
isPrimary={unit.value === selectedUnit} |
| 16 |
onClick={() => onClick(unit.value)} |
| 17 |
> |
| 18 |
{unit.label} |
| 19 |
</Button> |
| 20 |
))} |
| 21 |
</ButtonGroup> |
| 22 |
); |
| 23 |
|
| 24 |
export default UnitControl; |
| 25 |
|