2
0

feat(dashboard): Add lead generation template

While creating the template I also made sure to fix and improve everything I stumble upon
This commit is contained in:
Baptiste Arnaud
2022-02-07 07:13:16 +01:00
parent 524ef0812c
commit 1f320c5d99
20 changed files with 397 additions and 46 deletions

View File

@ -1,5 +1,5 @@
import { ChangeEvent, useEffect, useState } from 'react'
import { Button, Flex, HStack, Input, Stack } from '@chakra-ui/react'
import { Button, Flex, HStack, Input, Stack, Text } from '@chakra-ui/react'
import { SearchContextManager } from '@giphy/react-components'
import { UploadButton } from '../buttons/UploadButton'
import { GiphySearch } from './GiphySearch'
@ -39,7 +39,7 @@ export const ImageUploadContent = ({
>
Embed link
</Button>
{process.env.NEXT_PUBLIC_GIPHY_API_KEY && isGiphyEnabled && (
{isGiphyEnabled && (
<Button
variant={currentTab === 'giphy' ? 'solid' : 'ghost'}
onClick={() => setCurrentTab('giphy')}
@ -117,10 +117,14 @@ const EmbedLinkContent = ({ initialUrl, onNewUrl }: ContentProps) => {
)
}
const GiphyContent = ({ onNewUrl }: ContentProps) => (
<SearchContextManager
apiKey={process.env.NEXT_PUBLIC_GIPHY_API_KEY as string}
>
<GiphySearch onSubmit={onNewUrl} />
</SearchContextManager>
)
const GiphyContent = ({ onNewUrl }: ContentProps) => {
if (!process.env.NEXT_PUBLIC_GIPHY_API_KEY)
return <Text>NEXT_PUBLIC_GIPHY_API_KEY is missing in environment</Text>
return (
<SearchContextManager
apiKey={process.env.NEXT_PUBLIC_GIPHY_API_KEY as string}
>
<GiphySearch onSubmit={onNewUrl} />
</SearchContextManager>
)
}