Skip to content

Commit 94a782d

Browse files
authored
Merge pull request #16 from ethereum/static-layout
feat: Static layout
2 parents be4b018 + 925cd42 commit 94a782d

24 files changed

+1761
-518
lines changed

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,10 @@
1111
"dependencies": {
1212
"@chakra-ui/next-js": "^2.1.5",
1313
"@chakra-ui/react": "^2.8.0",
14+
"@docsearch/react": "^3.5.2",
1415
"@emotion/react": "^11.11.1",
1516
"@emotion/styled": "^11.11.0",
17+
"@storybook/react": "^7.3.2",
1618
"framer-motion": "^10.13.0",
1719
"gray-matter": "^4.0.3",
1820
"lodash.merge": "^4.6.2",

src/components/FeedbackCard.tsx

Lines changed: 50 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,16 @@ import React, { ReactNode, useState } from "react"
33
import { Flex, FlexProps, Heading } from "@chakra-ui/react"
44
// Component imports
55
import Button from "./Button"
6-
import Translation from "./Translation"
6+
// TODO: add Translation when i18n is set up
7+
// import Translation from "./Translation"
78
// SVG imports
89
import { FeedbackThumbsUpIcon } from "./icons"
910
// Utility imports
10-
import { trackCustomEvent } from "../utils/matomo"
11+
// TODO: add trackCustomEvent when util is migrated
12+
// import { trackCustomEvent } from "../utils/matomo"
1113
// Hook imports
12-
import { useSurvey } from "../hooks/useSurvey"
14+
// TODO: add useSurvey after hook is migrated
15+
// import { useSurvey } from "../hooks/useSurvey"
1316

1417
export interface IProps extends FlexProps {
1518
prompt?: string
@@ -22,36 +25,46 @@ const FeedbackCard: React.FC<IProps> = ({
2225
...props
2326
}) => {
2427
const [feedbackSubmitted, setFeedbackSubmitted] = useState(false)
25-
const surveyUrl = useSurvey(feedbackSubmitted)
28+
// const surveyUrl = useSurvey(feedbackSubmitted)
2629

2730
const location = typeof window !== "undefined" ? window.location.href : ""
2831
const isTutorial = location.includes("tutorials")
2932

3033
const getTitle = (feedbackSubmitted: boolean): ReactNode => {
3134
if (!feedbackSubmitted) {
3235
if (prompt) return prompt
33-
if (isTutorial) return <Translation id="feedback-card-prompt-tutorial" />
34-
if (isArticle) return <Translation id="feedback-card-prompt-article" />
35-
return <Translation id="feedback-card-prompt-page" />
36+
// TODO: add Translation when i18n is set up
37+
// if (isTutorial) return <Translation id="feedback-card-prompt-tutorial" />
38+
// if (isArticle) return <Translation id="feedback-card-prompt-article" />
39+
// return <Translation id="feedback-card-prompt-page" />
40+
41+
if (isTutorial) return "Was this tutorial helpful?"
42+
if (isArticle) return "Was this article helpful?"
43+
return "Was this page helpful?"
3644
}
37-
return <Translation id="feedback-widget-thank-you-title" />
45+
46+
// TODO: add Translation when i18n is set up
47+
// return <Translation id="feedback-widget-thank-you-title" />
48+
return "Thank you for your feedback!"
3849
}
3950

4051
const handleSubmit = (choice: boolean): void => {
41-
trackCustomEvent({
42-
eventCategory: `Page is helpful feedback`,
43-
eventAction: `Clicked`,
44-
eventName: String(choice),
45-
})
52+
// TODO: add trackCustomEvent when util is migrated
53+
// trackCustomEvent({
54+
// eventCategory: `Page is helpful feedback`,
55+
// eventAction: `Clicked`,
56+
// eventName: String(choice),
57+
// })
4658
setFeedbackSubmitted(true)
4759
}
4860
const handleSurveyOpen = (): void => {
49-
trackCustomEvent({
50-
eventCategory: `Feedback survey opened`,
51-
eventAction: `Clicked`,
52-
eventName: "Feedback survey opened",
53-
})
54-
window && surveyUrl && window.open(surveyUrl, "_blank")
61+
// TODO: add trackCustomEvent when util is migrated
62+
// trackCustomEvent({
63+
// eventCategory: `Feedback survey opened`,
64+
// eventAction: `Clicked`,
65+
// eventName: "Feedback survey opened",
66+
// })
67+
// window && surveyUrl && window.open(surveyUrl, "_blank")
5568
}
5669
return (
5770
<Flex
@@ -72,8 +85,15 @@ const FeedbackCard: React.FC<IProps> = ({
7285
</Heading>
7386
{feedbackSubmitted && (
7487
<p>
75-
<Translation id="feedback-widget-thank-you-subtitle" />{" "}
76-
<Translation id="feedback-widget-thank-you-subtitle-ext" />
88+
{/* TODO: add Translation when i18n is set up */}
89+
Make this page even better by answering a few questions.
90+
{/* <Translation id="feedback-widget-thank-you-subtitle" />{" "} */}
91+
{/* <Translation id="feedback-widget-thank-you-subtitle-ext" /> */}
92+
If you need help, you can reach out to the community on our{" "}
93+
<a href="https://discord.gg/rZz26QWfCg\" target="_blank\">
94+
Discord
95+
</a>
96+
.
7797
</p>
7898
)}
7999
<Flex gap={4}>
@@ -84,19 +104,25 @@ const FeedbackCard: React.FC<IProps> = ({
84104
leftIcon={<FeedbackThumbsUpIcon />}
85105
onClick={() => handleSubmit(true)}
86106
>
87-
<Translation id="yes" />
107+
{/* TODO: add Translation when i18n is set up */}
108+
{/* <Translation id="yes" /> */}
109+
Yes
88110
</Button>
89111
<Button
90112
variant="outline-color"
91113
leftIcon={<FeedbackThumbsUpIcon transform="scaleY(-1)" />}
92114
onClick={() => handleSubmit(false)}
93115
>
94-
<Translation id="no" />
116+
{/* TODO: add Translation when i18n is set up */}
117+
{/* <Translation id="no" /> */}
118+
No
95119
</Button>
96120
</>
97121
) : (
98122
<Button variant="outline-color" onClick={handleSurveyOpen}>
99-
<Translation id="feedback-widget-thank-you-cta" />
123+
{/* TODO: add Translation when i18n is set up */}
124+
{/* <Translation id="feedback-widget-thank-you-cta" /> */}
125+
Open short survey
100126
</Button>
101127
)}
102128
</Flex>

0 commit comments

Comments
 (0)