| 1 |
import { Button } from "@wordpress/components"; |
| 2 |
|
| 3 |
const Units = ({ units, onChange, activeUnit }) => { |
| 4 |
return ( |
| 5 |
<div className="sp-smart-post-units"> |
| 6 |
<div className="sp-smart-post-units-btn"> |
| 7 |
{units?.map((item, i) => ( |
| 8 |
<Button |
| 9 |
className={activeUnit === item.toLowerCase() ? "active" : ""} |
| 10 |
key={i} |
| 11 |
value={item} |
| 12 |
onClick={(e) => onChange(e.target.value.toLowerCase())} |
| 13 |
> |
| 14 |
{" "} |
| 15 |
{item}{" "} |
| 16 |
</Button> |
| 17 |
))} |
| 18 |
</div> |
| 19 |
</div> |
| 20 |
); |
| 21 |
}; |
| 22 |
|
| 23 |
export default Units; |
| 24 |
|