import { useStyles } from './FormTemplate.styles'; import MenuBookIcon from '@material-ui/icons/MenuBook'; import Codebox from '../Codebox/Codebox'; import { Collapse, IconButton, useMediaQuery, Tooltip, } from '@material-ui/core'; import { FileCopy, Info } from '@material-ui/icons'; import ConditionallyRender from '../ConditionallyRender'; import Loader from '../Loader/Loader'; import copy from 'copy-to-clipboard'; import useToast from 'hooks/useToast'; import React, { useState } from 'react'; import classNames from 'classnames'; import { ReactComponent as MobileGuidanceBG } from 'assets/img/mobileGuidanceBg.svg'; import { useCommonStyles } from 'themes/commonStyles'; interface ICreateProps { title: string; description: string; documentationLink: string; documentationLinkLabel: string; loading?: boolean; modal?: boolean; formatApiCode: () => string; } const FormTemplate: React.FC = ({ title, description, children, documentationLink, documentationLinkLabel, loading, modal, formatApiCode, }) => { const { setToastData } = useToast(); const styles = useStyles(); const commonStyles = useCommonStyles(); const smallScreen = useMediaQuery(`(max-width:${1099}px)`); const copyCommand = () => { if (copy(formatApiCode())) { setToastData({ title: 'Successfully copied the command', text: 'The command should now be automatically copied to your clipboard', autoHideDuration: 6000, type: 'success', show: true, }); } else { setToastData({ title: 'Could not copy the command', text: 'Sorry, but we could not copy the command.', autoHideDuration: 6000, type: 'error', show: true, }); } }; return (
} />
} elseShow={ <>

{title}

{children} } />{' '}

API Command{' '}

} />
); }; interface IMobileGuidance { description: string; documentationLink: string; documentationLinkLabel?: string; } const MobileGuidance = ({ description, documentationLink, documentationLinkLabel, }: IMobileGuidance) => { const [open, setOpen] = useState(false); const styles = useStyles(); return ( <>
setOpen(prev => !prev)} > ); }; interface IGuidanceProps { description: string; documentationLink: string; documentationLinkLabel?: string; } const Guidance: React.FC = ({ description, children, documentationLink, documentationLinkLabel = 'Learn more', }) => { const styles = useStyles(); return ( ); }; export default FormTemplate;