Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

LandingHero.tsx 3.7 KB

You have to be logged in to leave a comment. Sign In
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
  1. import { useEffect, useState } from 'react'
  2. import cx from 'classnames'
  3. import { useRouter } from 'next/router'
  4. import { useMainContext } from 'components/context/MainContext'
  5. import { Link } from 'components/Link'
  6. import { useProductLandingContext } from 'components/context/ProductLandingContext'
  7. import { useTranslation } from 'components/hooks/useTranslation'
  8. import { useVersion } from 'components/hooks/useVersion'
  9. export const LandingHero = () => {
  10. const { airGap } = useMainContext()
  11. const { product_video, shortTitle, beta_product, intro, introLinks } = useProductLandingContext()
  12. const { t } = useTranslation('product_landing')
  13. const [renderIFrame, setRenderIFrame] = useState(false)
  14. // delay iFrame rendering so that dom ready happens sooner
  15. useEffect(() => {
  16. setRenderIFrame(true)
  17. }, [])
  18. return (
  19. <header className="d-lg-flex gutter-lg mb-6">
  20. <div className={cx(product_video && 'col-12 col-lg-6 mb-3 mb-lg-0')}>
  21. <span className="text-mono color-text-secondary">Product</span>
  22. <h1 className="mb-3 font-mktg">
  23. {shortTitle}{' '}
  24. {beta_product && <span className="Label Label--success v-align-middle">Beta</span>}
  25. </h1>
  26. <div
  27. className="lead-mktg color-text-secondary"
  28. dangerouslySetInnerHTML={{ __html: intro }}
  29. />
  30. {/* idea to abstract the introLinks into something more component-like */}
  31. {/* {introLinks.map((link) => {
  32. return (
  33. <FullLink
  34. href={link.href}
  35. className={cx(
  36. 'btn-mktg btn-large f4 mt-3 mr-3',
  37. link.secondary && 'btn-outline-mktg'
  38. )}
  39. >
  40. {t(link.translationKeyLabel)}
  41. </FullLink>
  42. )
  43. })} */}
  44. {introLinks?.quickstart && (
  45. <FullLink href={introLinks.quickstart} className="btn-mktg btn-large f4 mt-3 mr-3">
  46. {t('quickstart')}
  47. </FullLink>
  48. )}
  49. {introLinks?.reference && (
  50. <FullLink
  51. href={introLinks.reference}
  52. className="btn-mktg btn-outline-mktg btn-large f4 mt-3 mr-3"
  53. >
  54. {t('reference')}
  55. </FullLink>
  56. )}
  57. {introLinks?.overview && (
  58. <FullLink
  59. href={introLinks.overview}
  60. className="btn-mktg btn-outline-mktg btn-large f4 mt-3 mr-3"
  61. >
  62. {t('overview')}
  63. </FullLink>
  64. )}
  65. </div>
  66. {product_video && (
  67. <div className="col-12 col-lg-6">
  68. <div className="position-relative" style={{ paddingBottom: '56.25%' }}>
  69. {!airGap && (
  70. <iframe
  71. title={`${shortTitle} Video`}
  72. className="top-0 left-0 position-absolute color-shadow-large rounded-1 width-full height-full"
  73. src={renderIFrame ? product_video : ''}
  74. frameBorder="0"
  75. allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
  76. allowFullScreen
  77. ></iframe>
  78. )}
  79. </div>
  80. </div>
  81. )}
  82. </header>
  83. )
  84. }
  85. // Fully Qualified Link - it includes the version and locale in the path
  86. type Props = {
  87. href: string
  88. children: React.ReactNode
  89. className?: string
  90. }
  91. export const FullLink = ({ href, children, className }: Props) => {
  92. const router = useRouter()
  93. const { currentVersion } = useVersion()
  94. const locale = router.locale || 'en'
  95. const fullyQualifiedHref = `/${locale}${
  96. currentVersion !== 'free-pro-team@latest' ? `/${currentVersion}` : ''
  97. }${href}`
  98. return (
  99. <Link href={fullyQualifiedHref} className={className}>
  100. {children}
  101. </Link>
  102. )
  103. }
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...