import React, { useContext } from 'react' import { usePrefix, IconWidget } from '@designable/react' import cls from 'classnames' import './styles.less' export interface IInputItemsContext { width?: string | number vertical?: boolean } export interface IInputItemsProps { className?: string style?: React.CSSProperties width?: string | number vertical?: boolean } export interface IInputItemProps { className?: string style?: React.CSSProperties icon?: React.ReactNode width?: string | number vertical?: boolean title?: React.ReactNode } const InputItemsContext = React.createContext(null) export const InputItems: React.FC & { Item: React.FC } = (props) => { const prefix = usePrefix('input-items') return (
{props.children}
) } InputItems.defaultProps = { width: '100%', } InputItems.Item = (props) => { const prefix = usePrefix('input-items-item') const ctx = useContext(InputItemsContext) return (
{props.icon && (
)} {props.title &&
{props.title}
}
{props.children}
) }