refactor: ♻️ Toast component
This commit is contained in:
20
apps/builder/components/shared/hooks/useToast.tsx
Normal file
20
apps/builder/components/shared/hooks/useToast.tsx
Normal file
@ -0,0 +1,20 @@
|
||||
import { useToast as useChakraToast, UseToastOptions } from '@chakra-ui/toast'
|
||||
|
||||
export const useToast = () => {
|
||||
const toast = useChakraToast()
|
||||
|
||||
const showToast = ({
|
||||
title,
|
||||
description,
|
||||
status = 'error',
|
||||
}: UseToastOptions) => {
|
||||
toast({
|
||||
position: 'bottom-right',
|
||||
description,
|
||||
title,
|
||||
status,
|
||||
})
|
||||
}
|
||||
|
||||
return { showToast }
|
||||
}
|
Reference in New Issue
Block a user