import * as React from 'react' import cx from 'classnames' import { Icon, } from '@wordpress/components' import { Button, } from '@ska/components' import './style.scss' export interface ButtonGridButtonProps { key?: string label: string icon: React.JSX.Element iconProps?: any onClick?: () => void disabled?: boolean as?: React.FC } export interface ButtonGridProps { /** How many columns of buttons. */ columns?: number /** Width of a button in the grid. */ width?: number buttons: ButtonGridButtonProps[] className?: string style?: any } const ButtonGrid: React.FC = ({ columns = 2, width = 16, buttons = [], className, style, ...props }) => { return (
{buttons.map((buttonProps, index) => { const { key = index, icon, iconProps = {}, as: ButtonComponent = Button, ...props } = buttonProps return ( } {...props} /> ) })}
) } export default ButtonGrid