2
0

fix(dashboard): 🐛 Template modal scroll

This commit is contained in:
Baptiste Arnaud
2022-04-09 10:48:09 -05:00
parent b1d30fcb3b
commit e941ce1e13
2 changed files with 6 additions and 65 deletions

View File

@ -1,64 +0,0 @@
import {
Modal,
ModalOverlay,
ModalContent,
ModalHeader,
ModalCloseButton,
ModalBody,
ModalFooter,
Button,
} from '@chakra-ui/react'
import { TypebotViewer } from 'bot-engine'
import { Typebot } from 'models'
import React from 'react'
import { parseTypebotToPublicTypebot } from 'services/publicTypebot'
import { TemplateProps } from './data'
type Props = {
template: TemplateProps
typebot: Typebot
isOpen: boolean
onCreateClick: () => void
onClose: () => void
}
export const PreviewModal = ({
template,
typebot,
isOpen,
onClose,
onCreateClick,
}: Props) => {
const handleCreateClick = () => {
onCreateClick()
onClose()
}
return (
<Modal
size="3xl"
isOpen={isOpen}
onClose={onClose}
blockScrollOnMount={false}
>
<ModalOverlay />
<ModalContent h="85vh">
<ModalHeader>
{(template.emoji ?? '') + ' ' + template.name}
</ModalHeader>
<ModalCloseButton />
<ModalBody>
<TypebotViewer typebot={parseTypebotToPublicTypebot(typebot)} />
</ModalBody>
<ModalFooter>
<Button mr={3} onClick={handleCreateClick}>
Use this template
</Button>
<Button variant="ghost" colorScheme="gray" onClick={onClose}>
Close
</Button>
</ModalFooter>
</ModalContent>
</Modal>
)
}

View File

@ -51,7 +51,12 @@ export const TemplatesModal = ({ isOpen, onClose, onTypebotChoose }: Props) => {
} }
return ( return (
<Modal isOpen={isOpen} onClose={onClose} size="6xl"> <Modal
isOpen={isOpen}
onClose={onClose}
size="6xl"
blockScrollOnMount={false}
>
<ModalOverlay /> <ModalOverlay />
<ModalContent h="85vh"> <ModalContent h="85vh">
<ModalBody as={HStack} p="0"> <ModalBody as={HStack} p="0">