2021-09-30 11:42:23 +05:00
|
|
|
export const Grid = ({children, style, ...other}) => {
|
2021-08-31 18:03:08 +05:00
|
|
|
const gridContainerStyle = {
|
|
|
|
display: 'grid',
|
2021-09-03 09:26:20 +05:00
|
|
|
margin: '8px',
|
|
|
|
justifyItems: 'stretch',
|
|
|
|
alignItems: 'stretch',
|
2021-09-30 11:42:23 +05:00
|
|
|
...style,
|
2021-08-31 18:03:08 +05:00
|
|
|
}
|
|
|
|
|
2021-09-30 11:42:23 +05:00
|
|
|
return <div style={gridContainerStyle} {...other}>
|
2021-08-31 18:03:08 +05:00
|
|
|
{children}
|
|
|
|
</div>
|
|
|
|
}
|
|
|
|
|
2021-09-30 11:42:23 +05:00
|
|
|
export const GridItem = ({children, row, col, rowSpan, colSpan, style, ...other}) => {
|
2021-08-31 18:03:08 +05:00
|
|
|
const localRow = +row
|
|
|
|
const localCol = +col
|
|
|
|
const localColSpan = colSpan ? colSpan - 1 : 0
|
|
|
|
const localRowSpan = rowSpan ? rowSpan - 1 : 0
|
|
|
|
const gridItemStyle = {
|
|
|
|
gridColumnStart: localCol,
|
|
|
|
gridColumnEnd: localCol + localColSpan,
|
|
|
|
gridRowStart: localRow,
|
|
|
|
gridRowEnd: localRow + localRowSpan,
|
2021-09-03 09:26:20 +05:00
|
|
|
padding: '4px',
|
2021-09-30 11:42:23 +05:00
|
|
|
...style,
|
2021-08-31 18:03:08 +05:00
|
|
|
}
|
|
|
|
|
2021-09-30 11:42:23 +05:00
|
|
|
return <div style={gridItemStyle} {...other}>
|
2021-08-31 18:03:08 +05:00
|
|
|
{children}
|
|
|
|
</div>
|
2021-09-30 11:42:23 +05:00
|
|
|
}
|
|
|
|
|
|
|
|
export const Flex = ({children, style, ...other}) =>
|
|
|
|
<div
|
|
|
|
style={{display:'flex', ...style}}
|
|
|
|
{...other}>
|
|
|
|
{children}
|
|
|
|
</div>
|