mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-23 23:18:36 +08:00
01d1b3d492
* demo: rewrite render function with React.FC * demo: rewrite render function with React.FC * fix: fix snap * Update components/splitter/Splitter.tsx Co-authored-by: afc163 <afc163@gmail.com> Signed-off-by: lijianan <574980606@qq.com> * fix: clear --------- Signed-off-by: lijianan <574980606@qq.com> Co-authored-by: afc163 <afc163@gmail.com>
32 lines
986 B
TypeScript
32 lines
986 B
TypeScript
import React from 'react';
|
|
import { Flex, Splitter, Typography } from 'antd';
|
|
import type { SplitterProps } from 'antd';
|
|
|
|
const Desc: React.FC<Readonly<{ text?: string | number }>> = (props) => (
|
|
<Flex justify="center" align="center" style={{ height: '100%' }}>
|
|
<Typography.Title type="secondary" level={5} style={{ whiteSpace: 'nowrap' }}>
|
|
{props.text}
|
|
</Typography.Title>
|
|
</Flex>
|
|
);
|
|
|
|
const CustomSplitter: React.FC<Readonly<SplitterProps>> = ({ style, ...restProps }) => (
|
|
<Splitter style={{ boxShadow: '0 0 10px rgba(0, 0, 0, 0.1)', ...style }} {...restProps}>
|
|
<Splitter.Panel collapsible min="20%">
|
|
<Desc text="First" />
|
|
</Splitter.Panel>
|
|
<Splitter.Panel collapsible>
|
|
<Desc text="Second" />
|
|
</Splitter.Panel>
|
|
</Splitter>
|
|
);
|
|
|
|
const App: React.FC = () => (
|
|
<Flex gap="middle" vertical>
|
|
<CustomSplitter style={{ height: 200 }} />
|
|
<CustomSplitter style={{ height: 300 }} layout="vertical" />
|
|
</Flex>
|
|
);
|
|
|
|
export default App;
|