ant-design/components/alert/demo/closable.tsx
Albert E. Hidalgo Taveras 860e58ee6f
demo: use closable prop (#43542)
* Update closable.tsx

Added `closable` prop

Signed-off-by: Albert E. Hidalgo Taveras <35310226+itsalb3rt@users.noreply.github.com>

* Apply suggestions from code review

Signed-off-by: afc163 <afc163@gmail.com>

---------

Signed-off-by: Albert E. Hidalgo Taveras <35310226+itsalb3rt@users.noreply.github.com>
Signed-off-by: afc163 <afc163@gmail.com>
Co-authored-by: afc163 <afc163@gmail.com>
2023-07-14 13:09:54 +08:00

27 lines
715 B
TypeScript

import { Alert, Space } from 'antd';
import React from 'react';
const onClose = (e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => {
console.log(e, 'I was closed.');
};
const App: React.FC = () => (
<Space direction="vertical" style={{ width: '100%' }}>
<Alert
message="Warning Text Warning Text Warning TextW arning Text Warning Text Warning TextWarning Text"
type="warning"
closable
onClose={onClose}
/>
<Alert
message="Error Text"
description="Error Description Error Description Error Description Error Description Error Description Error Description"
type="error"
closable
onClose={onClose}
/>
</Space>
);
export default App;