feat: show message common

:%s
This commit is contained in:
lytrankieio123
2021-09-29 14:23:42 +07:00
parent 02cc226ba7
commit ba6517ef39
9 changed files with 139 additions and 51 deletions

View File

@@ -1,35 +1,16 @@
import { Layout, MessageCommon } from 'src/components/common'
import { MessageItemProps } from 'src/components/common/MessageCommon/MessageItem/MessageItem'
import { Layout } from 'src/components/common'
import { useMessage } from 'src/components/contexts'
const data: MessageItemProps[] = [
{
id: 1,
content: 'Create account successfully',
type: 'error',
},
{
id: 2,
content: 'Create account successfully',
type: 'success',
},
{
id: 3,
content: 'Create account successfully',
type: 'warning',
},
{
id: 4,
content: 'Create account successfully',
type: 'info',
},
]
export default function Test() {
const { showMessageSuccess } = useMessage()
const handleClick = () => {
showMessageSuccess("Create account successfully")
}
return (
<>
<MessageCommon messages={data} />
{/* <MessageCommon type='error'>Create account successfully</MessageCommon>
<MessageCommon type='info'>Create account successfully</MessageCommon>
<MessageCommon type='warning'>Create account successfully</MessageCommon> */}
<button onClick={handleClick}>Click me</button>
</>
)
}