import { useEffect, useState } from 'react' import cx from 'classnames' import { useRouter } from 'next/router' import { LinkExternalIcon } from '@primer/octicons-react' import { Link } from 'components/Link' import { useProductLandingContext } from 'components/context/ProductLandingContext' import { useTranslation } from 'components/hooks/useTranslation' import { useVersion } from 'components/hooks/useVersion' import { Lead } from 'components/ui/Lead' export const LandingHero = () => { const { productVideo, shortTitle, title, beta_product, intro, introLinks } = useProductLandingContext() const { t } = useTranslation('product_landing') const [renderIFrame, setRenderIFrame] = useState(false) // delay iFrame rendering so that dom ready happens sooner useEffect(() => { setRenderIFrame(true) }, []) return (

{shortTitle || title}{' '} {beta_product && Beta}

{intro && {intro}} {introLinks && Object.entries(introLinks) .filter(([key, link]) => { return link && !key.includes('raw') }) .map(([key, link], i) => { if (!link) { return null } return ( {t(key) || key} ) })}
{productVideo && (
)}
) } // Fully Qualified Link - it includes the version and locale in the path if // the href is not an external link. type Props = { href: string children: React.ReactNode className?: string } export const FullLink = ({ href, children, className }: Props) => { const router = useRouter() const { currentVersion } = useVersion() const isExternal = href.startsWith('https') let linkHref = href if (!isExternal) { const locale = router.locale || 'en' linkHref = `/${locale}${ currentVersion !== 'free-pro-team@latest' ? `/${currentVersion}` : '' }${href}` } return ( {children}{' '} {isExternal && ( )} ) }