mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-24 07:28:28 +08:00
47bd5ecccc
* feat: typograohy support collapse * feat: snap * feat: test * feat: 单测不符合预期 * feat: test * feat: 恢复 * feat: test * feat: test * feat: 修改命名 * feat: 代码优化 * feat: 添加控制台提示 * feat: snap * feat: symbol support function * feat: snap * fix: text * feat: snap * feat: api 修改 * feat: key 修改 * feat: 去掉参数 * feat: lint * feat: snap * feat: test * feat: use 2 * feat: review * feat: test * chore: part of it * chore: fix auto collapse logic * feat: 修改 doc 单测 * feat: doc * test: update testcase * docs: add more --------- Co-authored-by: 二货机器人 <smith3816@gmail.com>
37 lines
956 B
TypeScript
37 lines
956 B
TypeScript
import React, { useState } from 'react';
|
|
import { Flex, Slider, Switch, Typography } from 'antd';
|
|
|
|
const App = () => {
|
|
const [rows, setRows] = useState(2);
|
|
const [expanded, setExpanded] = useState(false);
|
|
|
|
return (
|
|
<Flex gap={16} vertical>
|
|
<Flex gap={16} align="center">
|
|
<Switch
|
|
checked={expanded}
|
|
onChange={() => setExpanded((c) => !c)}
|
|
style={{ flex: 'none' }}
|
|
/>
|
|
<Slider min={1} max={20} value={rows} onChange={setRows} style={{ flex: 'auto' }} />
|
|
</Flex>
|
|
|
|
<Typography.Paragraph
|
|
ellipsis={{
|
|
rows,
|
|
expandable: 'collapsible',
|
|
expanded,
|
|
onExpand: (_, info) => setExpanded(info.expanded),
|
|
}}
|
|
copyable
|
|
>
|
|
{'Ant Design, a design language for background applications, is refined by Ant UED Team.'.repeat(
|
|
20,
|
|
)}
|
|
</Typography.Paragraph>
|
|
</Flex>
|
|
);
|
|
};
|
|
|
|
export default App;
|