diff options
| author | Jules Laplace <julescarbon@gmail.com> | 2018-09-16 16:03:41 +0200 |
|---|---|---|
| committer | Jules Laplace <julescarbon@gmail.com> | 2018-09-16 16:03:41 +0200 |
| commit | 14652eecb0fb4ebcb14e830504bfb02017bd010e (patch) | |
| tree | be42c8cd41fdad6387554af0ba05a546fc3121a9 /app/client/common/buttonGrid.component.js | |
| parent | c7f0268ad3d02a72e3639e289ab706fef1bb2645 (diff) | |
augmentation grid
Diffstat (limited to 'app/client/common/buttonGrid.component.js')
| -rw-r--r-- | app/client/common/buttonGrid.component.js | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/app/client/common/buttonGrid.component.js b/app/client/common/buttonGrid.component.js new file mode 100644 index 0000000..4b86d62 --- /dev/null +++ b/app/client/common/buttonGrid.component.js @@ -0,0 +1,32 @@ +import { h, Component } from 'preact' + +export default function ButtonGrid(props) { + const max = props.max || Infinity + return ( + <table className='buttonGrid'> + <tr className='row'> + <th>{" "}</th> + {props.x.map(x => ( + <th>{x}</th> + ))} + </tr> + {props.y.map(y => ( + <tr className='row'> + <th>{y}</th> + {props.x.map(x => ( + <td> + {x * y > max ? " " : + <button + onClick={() => props.onClick(x, y)} + onMouseEnter={() => props.onHover(x, y)} + > + {" "} + </button> + } + </td> + ))} + </tr> + ))} + </table> + ) +} |
