2023-12-07 17:08:22 +08:00
|
|
|
import React from 'react';
|
2023-11-30 17:26:17 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Component that displays a placeholder inside crate.
|
|
|
|
* Allows to display how it remains space for the current crate.
|
|
|
|
*/
|
2023-12-07 17:08:22 +08:00
|
|
|
export function FakePlaceholder({isDraggingOver, nToDraw}) {
|
|
|
|
const fakePlaceholder = [];
|
2023-11-30 17:26:17 +08:00
|
|
|
|
2023-12-07 17:08:22 +08:00
|
|
|
for (let i = nToDraw; i > 0; i--) {
|
|
|
|
fakePlaceholder.push(
|
|
|
|
<div key={i} style={{
|
|
|
|
display: isDraggingOver ? 'none' : 'block',
|
|
|
|
border: '1px dashed #ccc',
|
|
|
|
width: '45px',
|
|
|
|
marginBottom: '5px',
|
|
|
|
}}></div>
|
|
|
|
);
|
2023-11-30 17:26:17 +08:00
|
|
|
}
|
|
|
|
|
2023-12-07 17:08:22 +08:00
|
|
|
return (
|
|
|
|
<React.Fragment>
|
|
|
|
{fakePlaceholder}
|
|
|
|
</React.Fragment>
|
|
|
|
);
|
2023-11-30 17:26:17 +08:00
|
|
|
|
|
|
|
}
|