docs(share): 📝 Add embed instructions
This commit is contained in:
@ -0,0 +1,95 @@
|
||||
import { Stack, Tag, Text } from '@chakra-ui/react'
|
||||
|
||||
type JavascriptInstructionsProps = {
|
||||
type: 'standard' | 'popup' | 'bubble'
|
||||
}
|
||||
|
||||
export const JavascriptInstructions = ({
|
||||
type,
|
||||
}: JavascriptInstructionsProps) => {
|
||||
switch (type) {
|
||||
case 'standard': {
|
||||
return <StandardInstructions />
|
||||
}
|
||||
case 'popup': {
|
||||
return <PopupInstructions />
|
||||
}
|
||||
case 'bubble': {
|
||||
return <BubbleInstructions />
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const StandardInstructions = () => {
|
||||
// const [inputValues, setInputValues] = useState({
|
||||
// heightLabel: '100%',
|
||||
// widthLabel: '100%',
|
||||
// })
|
||||
|
||||
return (
|
||||
<Stack>
|
||||
<Text>
|
||||
Paste this anywhere in the <Tag>body</Tag>
|
||||
</Text>
|
||||
{/* <StandardEmbedWindowSettings
|
||||
onUpdateWindowSettings={(settings) => setInputValues({ ...settings })}
|
||||
/>
|
||||
<ContainerEmbedCode
|
||||
withStarterVariables={true}
|
||||
{...inputValues}
|
||||
mt={4}
|
||||
onCopied={() => sendJsCopyEvent('standard')}
|
||||
/> */}
|
||||
</Stack>
|
||||
)
|
||||
}
|
||||
|
||||
const PopupInstructions = () => {
|
||||
// const [inputValue, setInputValue] = useState(0)
|
||||
|
||||
return (
|
||||
<Stack>
|
||||
<Text>
|
||||
Paste this anywhere in the <Tag>body</Tag>
|
||||
</Text>
|
||||
{/* <StandardEmbedWindowSettings
|
||||
onUpdateWindowSettings={(settings) => setInputValues({ ...settings })}
|
||||
/>
|
||||
<ContainerEmbedCode
|
||||
withStarterVariables={true}
|
||||
{...inputValues}
|
||||
mt={4}
|
||||
onCopied={() => sendJsCopyEvent('standard')}
|
||||
/> */}
|
||||
</Stack>
|
||||
)
|
||||
}
|
||||
|
||||
const BubbleInstructions = () => {
|
||||
// const [inputValues, setInputValues] = useState<
|
||||
// Pick<BubbleParams, 'proactiveMessage' | 'button'>
|
||||
// >({
|
||||
// proactiveMessage: undefined,
|
||||
// button: {
|
||||
// color: '',
|
||||
// iconUrl: '',
|
||||
// },
|
||||
// })
|
||||
|
||||
return (
|
||||
<Stack>
|
||||
<Text>
|
||||
Paste this anywhere in the <Tag>body</Tag>
|
||||
</Text>
|
||||
{/* <StandardEmbedWindowSettings
|
||||
onUpdateWindowSettings={(settings) => setInputValues({ ...settings })}
|
||||
/>
|
||||
<ContainerEmbedCode
|
||||
withStarterVariables={true}
|
||||
{...inputValues}
|
||||
mt={4}
|
||||
onCopied={() => sendJsCopyEvent('standard')}
|
||||
/> */}
|
||||
</Stack>
|
||||
)
|
||||
}
|
@ -0,0 +1,67 @@
|
||||
import {
|
||||
Modal,
|
||||
ModalOverlay,
|
||||
ModalContent,
|
||||
ModalHeader,
|
||||
ModalCloseButton,
|
||||
ModalBody,
|
||||
ModalFooter,
|
||||
IconButton,
|
||||
Heading,
|
||||
HStack,
|
||||
} from '@chakra-ui/react'
|
||||
import { ChevronLeftIcon } from 'assets/icons'
|
||||
import React, { useState } from 'react'
|
||||
import { ModalProps } from '../../EmbedButton'
|
||||
import { ChooseEmbedTypeList } from '../ChooseEmbedTypeList'
|
||||
import { capitalize } from 'utils'
|
||||
import { PublishFirstInfo } from 'components/shared/Info'
|
||||
import { JavascriptInstructions } from './JavascriptInstructions'
|
||||
|
||||
export const JavascriptModal = ({
|
||||
isOpen,
|
||||
onClose,
|
||||
isPublished,
|
||||
}: ModalProps) => {
|
||||
const [chosenEmbedType, setChosenEmbedType] = useState<
|
||||
'standard' | 'popup' | 'bubble' | undefined
|
||||
>()
|
||||
return (
|
||||
<Modal
|
||||
isOpen={isOpen}
|
||||
onClose={onClose}
|
||||
size={!chosenEmbedType ? '2xl' : 'xl'}
|
||||
>
|
||||
<ModalOverlay />
|
||||
<ModalContent>
|
||||
<ModalHeader>
|
||||
<HStack>
|
||||
{chosenEmbedType && (
|
||||
<IconButton
|
||||
icon={<ChevronLeftIcon />}
|
||||
aria-label="back"
|
||||
variant="ghost"
|
||||
colorScheme="gray"
|
||||
mr={2}
|
||||
onClick={() => setChosenEmbedType(undefined)}
|
||||
/>
|
||||
)}
|
||||
<Heading size="md">
|
||||
Javascript {chosenEmbedType && `- ${capitalize(chosenEmbedType)}`}
|
||||
</Heading>
|
||||
</HStack>
|
||||
</ModalHeader>
|
||||
<ModalCloseButton />
|
||||
<ModalBody>
|
||||
{!isPublished && <PublishFirstInfo mb="2" />}
|
||||
{!chosenEmbedType ? (
|
||||
<ChooseEmbedTypeList onSelectEmbedType={setChosenEmbedType} />
|
||||
) : (
|
||||
<JavascriptInstructions type={chosenEmbedType} />
|
||||
)}
|
||||
</ModalBody>
|
||||
<ModalFooter />
|
||||
</ModalContent>
|
||||
</Modal>
|
||||
)
|
||||
}
|
Reference in New Issue
Block a user