import React from 'react'; import { SmileOutlined } from '@ant-design/icons'; import { DatePicker, Flex, Segmented } from 'antd'; import SemanticPreview from '../../../.dumi/theme/common/SemanticPreview'; import useLocale from '../../../.dumi/hooks/useLocale'; const locales = { cn: { root: '根元素', prefix: '前缀元素', input: '输入框元素', suffix: '后缀元素', popup: '弹出框元素', popupHeader: '弹出框头部元素', popupBody: '弹出框主体元素', popupContent: '弹出框内容元素', popupItem: '弹出框单项元素', popupFooter: '弹出框底部元素', }, en: { root: 'Root element', prefix: 'Prefix element', input: 'Input element', suffix: 'Suffix element', popup: 'Popup element', popupHeader: 'Popup header element', popupBody: 'Popup body element', popupContent: 'Popup content element', popupItem: 'Popup content item element', popupFooter: 'Popup footer element', }, }; interface BlockProps { singleComponent: React.ComponentType; multipleComponent: React.ComponentType; type: 'Single' | 'Multiple'; setType: (type: 'Single' | 'Multiple') => void; } const Block = (props: BlockProps) => { const { singleComponent: SingleComponent, multipleComponent: MultipleComponent, type, setType, ...restProps } = props; const divRef = React.useRef(null); const config = { ...restProps, prefix: , zIndex: 1, open: true, getPopupContainer: () => divRef!.current!, needConfirm: true, }; const picker = type === 'Single' ? : ; return ( {picker} ); }; export interface PickerSemanticTemplateProps { singleComponent: [string, React.ComponentType]; multipleComponent: [string, React.ComponentType]; ignoreSemantics?: string[]; } export function PickerSemanticTemplate(props: PickerSemanticTemplateProps) { const { singleComponent, multipleComponent, ignoreSemantics = [] } = props; const [type, setType] = React.useState<'Single' | 'Multiple'>('Single'); const [locale] = useLocale(locales); return ( !ignoreSemantics.includes(semantic.name))} > ); } const App: React.FC = () => { return ( ); }; export default App;