import React, { forwardRef, ElementRef, ReactNode } from 'react' import { ComponentProps } from '@stitches/react' import { isText } from '@aviato/utils' import { Text } from '~/components/Text' import { Group } from '~/components' import { styled } from '~/theme' const StyledListSection = styled('div', {}) const Container = styled('div', { display: 'flex', flexDirection: 'row', flexShrink: 0, variants: { type: { top: {}, bottom: {}, }, }, }) export interface ListSectionProps extends ComponentProps { top: ReactNode bottom: ReactNode } export const ListSection = forwardRef< ElementRef, ListSectionProps >((properties, forwardedRef) => { const { top, bottom, ...remainingProps } = properties const TopChild = isText(top) ? ( {top} ) : ( top ) const BottomChild = isText(bottom) ? ( {bottom} ) : ( bottom ) return ( {TopChild} {BottomChild} ) })