blob: ed0bf0b33709a740b964e1f585b04d3e52b81cb8 [file] [log] [blame]
pineafan15b813d2022-02-13 10:06:09 +00001import react, { Component, cloneElement } from "react";
2import Styles from '../styles/tilerow.module.css';
3
4class TileRow extends Component {
5 constructor(props) {
6 super(props);
7 }
8 render() {
9 return (
10 <div className={Styles.container}>
11 {
12 react.Children.toArray(this.props.children).map((item, index) => {
13 if (this.props.divless !== false) { // Intentional comparison to false, initially had a default of false, now has a default of true
14 const className = (item.props.className ? item.props.className + " " : "") + Styles.item
15
16 const key = index;
17
18 const props = {
19 className,
20 key
21 }
22
23 return cloneElement(item, props);
24 } else {
25 return <div className={Styles.item + " " + Styles.fitItemWidth} key={index}>{item}</div>;
26 }
27 })
28 }
29 </div>
30 )
31 }
32}
33export default TileRow;