Skip to content

Commit 94db96d

Browse files
committed
feat: add ogp-awareness to form end page
1 parent 800439f commit 94db96d

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

frontend/src/components/FormEndPage/EndPageBlock.tsx

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { useEffect, useMemo, useRef } from 'react'
22
import { useTranslation } from 'react-i18next'
33
import { Box, Text, VisuallyHidden } from '@chakra-ui/react'
4+
import { useFeatureValue } from '@growthbook/growthbook-react'
45
import { format } from 'date-fns'
56

67
import {
@@ -11,6 +12,8 @@ import {
1112
PublicFormDto,
1213
} from '~shared/types/form'
1314

15+
import { OgpAwarenessBadge } from '~assets/svgrs/brand/OgpAwarenessBadge'
16+
import { OgpAwarenessBanner } from '~assets/svgrs/brand/OgpAwarenessBanner'
1417
import { useMdComponents } from '~hooks/useMdComponents'
1518
import { getValueInSelectedLanguage } from '~utils/multiLanguage'
1619
import { MarkdownText } from '~components/MarkdownText'
@@ -85,6 +88,18 @@ export const EndPageBlock = ({
8588
return 'You have successfully submitted your response.'
8689
}, [formTitle])
8790

91+
const ogpAwareness = useFeatureValue('ogp-awareness', 'none')
92+
const ogpAwarenessComponent = (() => {
93+
switch (ogpAwareness) {
94+
case 'banner':
95+
return <OgpAwarenessBanner />
96+
case 'badge':
97+
return <OgpAwarenessBadge />
98+
default:
99+
return <></>
100+
}
101+
})()
102+
88103
return (
89104
<>
90105
<Box ref={focusRef}>
@@ -100,6 +115,7 @@ export const EndPageBlock = ({
100115
</Box>
101116
) : null}
102117
</Box>
118+
{ogpAwareness && <Box mt="1rem">{ogpAwarenessComponent}</Box>}
103119
<Box mt="1rem">
104120
<Box>
105121
<Text textColor="secondary.300" textStyle="caption-2">

0 commit comments

Comments
 (0)