Files
bot/apps/builder/src/features/folders/components/CreateBotButton.tsx

50 lines
1.2 KiB
TypeScript
Raw Normal View History

2021-12-06 15:48:50 +01:00
import { Button, ButtonProps, Text, VStack } from '@chakra-ui/react'
import { PlusIcon } from '@/components/icons'
2021-12-06 15:48:50 +01:00
import { useRouter } from 'next/router'
2022-03-23 09:56:39 +01:00
import { stringify } from 'qs'
2021-12-06 15:48:50 +01:00
import React from 'react'
import { useScopedI18n } from '@/locales'
2021-12-06 15:48:50 +01:00
export const CreateBotButton = ({
folderId,
2022-03-23 09:56:39 +01:00
isFirstBot,
2021-12-06 15:48:50 +01:00
...props
2022-03-23 09:56:39 +01:00
}: { folderId?: string; isFirstBot: boolean } & ButtonProps) => {
const scopedT = useScopedI18n('folders.createTypebotButton')
2021-12-06 15:48:50 +01:00
const router = useRouter()
const handleClick = () =>
2022-03-23 09:56:39 +01:00
router.push(
`/typebots/create?${stringify({
isFirstBot: !isFirstBot ? undefined : isFirstBot,
folderId,
})}`
)
2021-12-06 15:48:50 +01:00
return (
<Button
mr={{ sm: 6 }}
mb={6}
style={{ width: '225px', height: '270px' }}
onClick={handleClick}
paddingX={6}
whiteSpace={'normal'}
2021-12-23 09:37:42 +01:00
colorScheme="blue"
2021-12-06 15:48:50 +01:00
{...props}
>
<VStack spacing="6">
<PlusIcon fontSize="40px" />
<Text
fontSize={18}
fontWeight="medium"
maxW={40}
textAlign="center"
mt="6"
>
{scopedT('label')}
2021-12-06 15:48:50 +01:00
</Text>
</VStack>
</Button>
)
}