1
1
// Library imports
2
2
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"
5
4
// Component imports
6
5
import Button from "./Button"
7
6
import Translation from "./Translation"
8
7
// SVG imports
9
8
import ThumbsUp from "../assets/feedback-thumbs-up.svg"
10
9
// Utility imports
11
10
import { trackCustomEvent } from "../utils/matomo"
11
+ // Hook imports
12
12
import { useSurvey } from "../hooks/useSurvey"
13
13
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 {
44
15
prompt ?: string
45
16
isArticle ?: boolean
46
- className ?: string
47
17
}
48
18
49
19
const FeedbackCard : React . FC < IProps > = ( {
50
20
prompt,
51
21
isArticle = false ,
52
- className ,
22
+ ... props
53
23
} ) => {
54
24
const [ feedbackSubmitted , setFeedbackSubmitted ] = useState ( false )
55
25
const surveyUrl = useSurvey ( feedbackSubmitted )
@@ -84,16 +54,29 @@ const FeedbackCard: React.FC<IProps> = ({
84
54
window && surveyUrl && window . open ( surveyUrl , "_blank" )
85
55
}
86
56
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 >
90
73
{ feedbackSubmitted && (
91
74
< p >
92
75
< Translation id = "feedback-widget-thank-you-subtitle" /> { " " }
93
76
< Translation id = "feedback-widget-thank-you-subtitle-ext" />
94
77
</ p >
95
78
) }
96
- < ButtonContainer >
79
+ < Flex gap = { 4 } >
97
80
{ ! feedbackSubmitted ? (
98
81
< >
99
82
< Button
@@ -118,9 +101,9 @@ const FeedbackCard: React.FC<IProps> = ({
118
101
< Translation id = "feedback-widget-thank-you-cta" />
119
102
</ Button >
120
103
) }
121
- </ ButtonContainer >
122
- </ Content >
123
- </ Card >
104
+ </ Flex >
105
+ </ Flex >
106
+ </ Flex >
124
107
)
125
108
}
126
109
0 commit comments