Skip to content

Commit 8791994

Browse files
authored
Merge pull request #7906 from ethereum/feedback-v2
Update feedback components for Chakra
2 parents a76c2af + 80523b8 commit 8791994

File tree

11 files changed

+200
-264
lines changed

11 files changed

+200
-264
lines changed

src/@chakra-ui/gatsby-plugin/components/Button.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,5 +90,17 @@ export const Button: ComponentStyleConfig = {
9090
color: "primary",
9191
borderColor: "primary",
9292
},
93+
icon: {
94+
appearance: "none",
95+
background: "inherit",
96+
padding: "initial",
97+
border: 0,
98+
color: "inherit",
99+
boxShadow: "none",
100+
_hover: {
101+
color: "primary",
102+
boxShadow: "none",
103+
},
104+
},
93105
},
94106
}

src/assets/feedback-glyph.svg

Lines changed: 3 additions & 3 deletions
Loading

src/components/FeedbackCard.tsx

Lines changed: 24 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,25 @@
11
// Library imports
22
import React, { ReactNode, useState } from "react"
3-
import { Icon } from "@chakra-ui/react"
4-
import styled from "@emotion/styled"
3+
import { Flex, FlexProps, Heading, Icon } from "@chakra-ui/react"
54
// Component imports
65
import Button from "./Button"
76
import Translation from "./Translation"
87
// SVG imports
98
import ThumbsUp from "../assets/feedback-thumbs-up.svg"
109
// Utility imports
1110
import { trackCustomEvent } from "../utils/matomo"
11+
// Hook imports
1212
import { useSurvey } from "../hooks/useSurvey"
1313

14-
const Card = styled.div`
15-
border: 1px solid ${({ theme }) => theme.colors.border};
16-
background: ${({ theme }) => theme.colors.feedbackGradient};
17-
border-radius: 4px;
18-
padding: 1.5rem;
19-
display: flex;
20-
flex-direction: column;
21-
margin-bottom: 1rem;
22-
margin-top: 2rem;
23-
width: 100%;
24-
`
25-
26-
const Content = styled.div`
27-
display: flex;
28-
flex-direction: column;
29-
gap: 1rem;
30-
`
31-
32-
const Title = styled.h3`
33-
margin: 0 0 0.5rem;
34-
font-size: 1.375rem;
35-
font-weight: 700;
36-
`
37-
38-
const ButtonContainer = styled.div`
39-
display: flex;
40-
gap: 1rem;
41-
`
42-
43-
export interface IProps {
14+
export interface IProps extends FlexProps {
4415
prompt?: string
4516
isArticle?: boolean
46-
className?: string
4717
}
4818

4919
const FeedbackCard: React.FC<IProps> = ({
5020
prompt,
5121
isArticle = false,
52-
className,
22+
...props
5323
}) => {
5424
const [feedbackSubmitted, setFeedbackSubmitted] = useState(false)
5525
const surveyUrl = useSurvey(feedbackSubmitted)
@@ -84,16 +54,29 @@ const FeedbackCard: React.FC<IProps> = ({
8454
window && surveyUrl && window.open(surveyUrl, "_blank")
8555
}
8656
return (
87-
<Card className={className}>
88-
<Content>
89-
<Title>{getTitle(feedbackSubmitted)}</Title>
57+
<Flex
58+
border="1px"
59+
borderColor="border"
60+
bg="feedbackGradient"
61+
borderRadius="base"
62+
p={6}
63+
direction="column"
64+
mb={4}
65+
mt={8}
66+
w="full"
67+
{...props}
68+
>
69+
<Flex direction="column" gap={4}>
70+
<Heading as="h3" m={0} mb={2} fontSize="1.375rem" fontWeight="bold">
71+
{getTitle(feedbackSubmitted)}
72+
</Heading>
9073
{feedbackSubmitted && (
9174
<p>
9275
<Translation id="feedback-widget-thank-you-subtitle" />{" "}
9376
<Translation id="feedback-widget-thank-you-subtitle-ext" />
9477
</p>
9578
)}
96-
<ButtonContainer>
79+
<Flex gap={4}>
9780
{!feedbackSubmitted ? (
9881
<>
9982
<Button
@@ -118,9 +101,9 @@ const FeedbackCard: React.FC<IProps> = ({
118101
<Translation id="feedback-widget-thank-you-cta" />
119102
</Button>
120103
)}
121-
</ButtonContainer>
122-
</Content>
123-
</Card>
104+
</Flex>
105+
</Flex>
106+
</Flex>
124107
)
125108
}
126109

0 commit comments

Comments
 (0)