import React from 'react';
import { VStack, Box, Text, IIconProps, Icon } from '../../primitives';
import type { IListProps, IListItemProps } from './props';
const List = ({ style, children, spacing, ...props }: IListProps) => {
// add props to children
children = React.Children.map(children, (child: any, ind: number) => {
return React.cloneElement(
child,
{ index: ind, ...props },
child.props.children
);
});
return (
{children}
);
};
export const Ol = ({ style, children, spacing, ...props }: IListProps) => {
// add props to children
children = React.Children.map(children, (child: any, ind: number) => {
return React.cloneElement(
child,
{ index: ind, ...props, ol: true },
child.props.children
);
});
return (
{children}
);
};
export const Ul = ({ style, children, spacing, ...props }: IListProps) => {
// add props to children
children = React.Children.map(children, (child: any, ind: number) => {
return React.cloneElement(
child,
{ index: ind, ...props, ul: true },
child.props.children
);
});
return (
{children}
);
};
export const ListItem = (props: IListItemProps) => {
const { children, unordered, ul, ordered, ol, ...remainingProps } = props;
const startNum = remainingProps.start ? remainingProps.start : 1; // Ordered list starting number
return (
{unordered || ul ? ( //Adding disc in front of ListItem
{`\u2022`}
) : null}
{ordered || ol ? ( //Adding index number in front of ListItem
{remainingProps.index + startNum + '.'}
) : null}
{children}
);
};
export const ListIcon = (props: IIconProps) => {
return ;
};
export { IListProps, IListItemProps } from './props';
export default List;