spaCy/website/src/components/grid.js

34 lines
781 B
JavaScript
Raw Normal View History

import React from 'react'
import PropTypes from 'prop-types'
import classNames from 'classnames'
import classes from '../styles/grid.module.sass'
2020-08-06 02:22:49 +03:00
export default function Grid({
cols = 1,
narrow = false,
gutterBottom = true,
className,
2020-09-12 18:05:10 +03:00
style,
2020-08-06 02:22:49 +03:00
children,
}) {
const gridClassNames = classNames(classes.root, className, {
[classes.narrow]: narrow,
[classes.spacing]: gutterBottom,
[classes.half]: cols === 2,
[classes.third]: cols === 3,
[classes.quarter]: cols === 4,
})
2020-09-12 18:05:10 +03:00
return (
<div className={gridClassNames} style={style}>
{children}
</div>
)
}
Grid.propTypes = {
cols: PropTypes.oneOf([1, 2, 3, 4]),
narrow: PropTypes.bool,
gutterBottom: PropTypes.bool,
}