import React, { forwardRef, ElementRef } from 'react' import { ComponentProps } from '@stitches/react' // import { filterChildrenByType } from '@aviato/utils' import { styled } from '~/theme' import { ListItem, ListItemProps } from './ListItem' import { Conditional, Group } from '~/components' const StyledList = styled('div', { width: '100%', height: '100%', overflow: 'hidden', background: '$Background1dp', variants: { type: { simple: { padding: 16, borderRadius: 4, background: '$Background1dp', }, complex: { borderRadius: 4, border: '1px solid $OtherDivider', }, floating: {}, }, }, }) export type ListType = 'simple' | 'complex' | 'floating' export interface ListProps extends ComponentProps { type?: ListType header?: ListItemProps footer?: ListItemProps isDraggable?: boolean } export const List = forwardRef, ListProps>( (properties, forwardedRef) => { const { children, header, footer, type = header || footer ? 'complex' : 'simple', isDraggable = false, ...remainingProps } = properties const listItemChildren = Array.isArray(children) ? children : [children] // const listItemChildren = filterChildrenByType(children, ListItem) // console.info(children, listItemChildren) const listItems = listItemChildren.map((listItem, index) => { return ( ) }) const spacing = type === 'floating' ? 'sm' : 'none' return ( {listItems} ) } ) List.displayName = 'List'