♻️ (builder) Change to features-centric folder structure
This commit is contained in:
committed by
Baptiste Arnaud
parent
3686465a85
commit
643571fe7d
22
apps/builder/src/hooks/useToast.ts
Normal file
22
apps/builder/src/hooks/useToast.ts
Normal file
@ -0,0 +1,22 @@
|
||||
import { useToast as useChakraToast, UseToastOptions } from '@chakra-ui/react'
|
||||
import { useCallback } from 'react'
|
||||
|
||||
export const useToast = () => {
|
||||
const toast = useChakraToast()
|
||||
|
||||
const showToast = useCallback(
|
||||
({ title, description, status = 'error', ...props }: UseToastOptions) => {
|
||||
toast({
|
||||
position: 'top-right',
|
||||
description,
|
||||
title,
|
||||
status,
|
||||
isClosable: true,
|
||||
...props,
|
||||
})
|
||||
},
|
||||
[toast]
|
||||
)
|
||||
|
||||
return { showToast }
|
||||
}
|
Reference in New Issue
Block a user