1
0
mirror of https://github.com/phuoc-ng/csslayout.git synced 2025-10-22 18:26:39 +02:00
Files
csslayout/client/placeholders/Block.tsx
2019-11-24 23:20:19 +07:00

29 lines
824 B
TypeScript

import React from 'react';
import random from '../helpers/random';
interface BlockProps {
blockHeight?: number;
justify?: string;
numberOfBlocks?: number;
}
const Block: React.FC<BlockProps> = ({ justify = 'start', numberOfBlocks = 1, blockHeight = 4 }) => {
return (
<div className={`flex flex-wrap w-100 justify-${justify}`}>
{
Array(numberOfBlocks).fill(0).map((_, i) => {
const s = random(1, 5);
return (
<div key={i} className={`mr2 mb2 w-${s * 10}`}>
<div className="w-100 bg-black-30 br-pill" style={{ height: `${blockHeight}px` }} />
</div>
);
})
}
</div>
);
};
export default Block;