import React, {PureComponent} from 'react' import PropTypes from "prop-types"; import {nbrOccupiedSlotsInCrate} from "./utils"; /** * Component that displays a placeholder inside crate. * Allows to display how it remains space for the current crate. */ export class FakePlaceholder extends PureComponent { static get propTypes() { return { isDraggingOver: PropTypes.bool, nbrSlots: PropTypes.number.isRequired, items: PropTypes.array.isRequired, }; } render() { const { isDraggingOver, nbrSlots, items, } = this.props; const fakePlaceholder = []; const nbrOccupied = nbrOccupiedSlotsInCrate(items); for (var i = (nbrSlots - nbrOccupied); i > 0; i--) { fakePlaceholder.push(
); } return ( {fakePlaceholder} ); } }