blob: ed0bf0b33709a740b964e1f585b04d3e52b81cb8 [file] [log] [blame]
import react, { Component, cloneElement } from "react";
import Styles from '../styles/tilerow.module.css';
class TileRow extends Component {
constructor(props) {
super(props);
}
render() {
return (
<div className={Styles.container}>
{
react.Children.toArray(this.props.children).map((item, index) => {
if (this.props.divless !== false) { // Intentional comparison to false, initially had a default of false, now has a default of true
const className = (item.props.className ? item.props.className + " " : "") + Styles.item
const key = index;
const props = {
className,
key
}
return cloneElement(item, props);
} else {
return <div className={Styles.item + " " + Styles.fitItemWidth} key={index}>{item}</div>;
}
})
}
</div>
)
}
}
export default TileRow;