2
0

refactor: ♻️ Toast component

This commit is contained in:
Baptiste Arnaud
2022-06-02 07:54:48 +02:00
parent 43fb8a7be0
commit 12f2e40152
26 changed files with 148 additions and 177 deletions

View File

@ -6,11 +6,11 @@ import {
Flex,
FlexProps,
useEventListener,
useToast,
UseToastOptions,
VStack,
} from '@chakra-ui/react'
import { TypebotViewer } from 'bot-engine'
import { useToast } from 'components/shared/hooks/useToast'
import { headerHeight } from 'components/shared/TypebotHeader'
import { useEditor } from 'contexts/EditorContext'
import { useGraph } from 'contexts/GraphContext'
@ -33,9 +33,7 @@ export const PreviewDrawer = () => {
[typebot]
)
const toast = useToast({
position: 'top-right',
})
const { showToast } = useToast()
const handleMouseDown = () => {
setIsResizing(true)
@ -60,7 +58,7 @@ export const PreviewDrawer = () => {
}
const handleNewLog = (log: Omit<Log, 'id' | 'createdAt' | 'resultId'>) =>
toast(log as UseToastOptions)
showToast(log as UseToastOptions)
return (
<Flex