import * as React from "react";
import { ReactElement } from "react";
import { styleSheet } from '../StyleSheet'
const styles = styleSheet(require('./Separators.module.scss'));
export const Separated = ({ sep, items, children }: { children?: any, items?: ReactElement[], sep: ReactElement | string }) => {
items ||= React.Children.toArray(children) as any;
const bits = [];
for (let i = 0; i < items.length; i++) {
if (i > 0) {
const sbit = typeof sep == 'string' ? sep : React.cloneElement(sep, { key: `sep-${i}` });
bits.push(sbit);
}
bits.push(
{items[i]}
);
}
return {bits}
}
Separated.stylesheet = styles;