ant-design/components/alert/design/demo/action.tsx
MadCcc 5068137a1b
docs: add alert design page (#47037)
* docs: add alert design page

* chore: code clean

* fix: fallback style
2024-01-19 14:47:04 +08:00

103 lines
4.7 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import React from 'react';
import { Alert, Flex, Typography } from 'antd';
const Demo = () => {
const [expandA, setExpandA] = React.useState(false);
const [expandB, setExpandB] = React.useState(true);
return (
<Flex gap="large" vertical style={{ maxWidth: 600 }}>
<Flex gap="middle" vertical>
<div></div>
<Alert showIcon closable message="你好!欢迎使用专业版,你可以根据自身需求添加业务模块。" />
<Alert
showIcon
closable
message="帮助信息"
description="你好,由于你的良好信用,我们决定赠送你三个月产品会员,欲了解会员特权与活动请进首页会员专区查看。"
/>
</Flex>
<Flex gap="middle" vertical>
<div>/</div>
<Alert
showIcon
closable
message={
<div>
<Typography.Paragraph ellipsis={!expandA && { rows: 2 }} style={{ marginBottom: 8 }}>
2使2使2使2使2使
</Typography.Paragraph>
<Typography.Link onClick={() => setExpandA((prev) => !prev)}>
{expandA ? '收起' : '展开更多'}
</Typography.Link>
</div>
}
style={{ alignItems: 'baseline' }}
/>
<Alert
showIcon
closable
message={
<div>
<Typography.Paragraph ellipsis={!expandB && { rows: 2 }} style={{ marginBottom: 8 }}>
2使2使2使2使2使
</Typography.Paragraph>
<Typography.Link onClick={() => setExpandB((prev) => !prev)}>
{expandB ? '收起' : '展开更多'}
</Typography.Link>
</div>
}
style={{ alignItems: 'baseline' }}
/>
</Flex>
<Flex gap="middle" vertical>
<div></div>
<Alert
showIcon
closable
message="提示信息不超过一行时,按钮放在信息右侧。"
action={<Typography.Link></Typography.Link>}
/>
<Alert
showIcon
closable
message={
<div>
<Typography.Paragraph style={{ marginBottom: 8 }}>
</Typography.Paragraph>
<Flex gap={8}>
<Typography.Link>1</Typography.Link>
<Typography.Link>2</Typography.Link>
</Flex>
</div>
}
style={{ alignItems: 'baseline' }}
/>
<Alert
showIcon
closable
message="提示标题"
description={
<div>
<Typography.Paragraph style={{ marginBottom: 8 }}>
</Typography.Paragraph>
<Flex gap={8}>
<Typography.Link>1</Typography.Link>
<Typography.Link>2</Typography.Link>
</Flex>
</div>
}
/>
<Typography.Paragraph type="secondary">
使Link
Button线
</Typography.Paragraph>
</Flex>
</Flex>
);
};
export default Demo;