flecks/website/helpers/image-row.jsx

20 lines
603 B
React
Raw Normal View History

2024-01-02 15:13:43 -06:00
import React from 'react';
export default function ImageRow({children}) {
return (
<div style={{display: 'flex', marginBottom: 'var(--ifm-leading)'}}>
{React.Children.map(children, (child, i) => {
const count = React.Children.count(children);
return React.cloneElement(
child,
{
style: {
marginLeft: 0 === i ? '0' : `calc(var(--ifm-spacing-horizontal) * 1 / ${count - 1})`,
width: `calc(${100 / count}% - var(--ifm-spacing-horizontal) / ${count})`,
},
},
);
})}
</div>
);
}