Skip to content

Commit afd1d65

Browse files
committed
migrate feedbackcard component
1 parent f1a98ed commit afd1d65

File tree

4 files changed

+26
-26
lines changed

4 files changed

+26
-26
lines changed

src/components/FeedbackCard.tsx

Lines changed: 13 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
import { type ReactNode, useState } from "react"
22
import { useRouter } from "next/router"
33
import { useTranslation } from "next-i18next"
4-
import { Flex, type FlexProps, Heading } from "@chakra-ui/react"
54

65
import type { Lang } from "@/lib/types"
76

8-
import { Button } from "@/components/Buttons"
97
import { FeedbackThumbsUpIcon } from "@/components/icons"
108

119
import { trackCustomEvent } from "@/lib/utils/matomo"
1210
import { isLangRightToLeft } from "@/lib/utils/translations"
1311

12+
import { Button } from "../../tailwind/ui/buttons/Button"
13+
1414
import Translation from "./Translation"
1515

1616
import { useSurvey } from "@/hooks/useSurvey"
1717

18-
type FeedbackCardProps = FlexProps & {
18+
type FeedbackCardProps = {
1919
prompt?: string
2020
isArticle?: boolean
2121
}
@@ -60,44 +60,34 @@ const FeedbackCard = ({ prompt, isArticle, ...props }: FeedbackCardProps) => {
6060
}
6161

6262
return (
63-
<Flex
64-
border="1px"
65-
borderColor="border"
66-
bg="feedbackGradient"
67-
borderRadius="base"
68-
p="6"
69-
direction="column"
70-
mb="4"
71-
mt="8"
72-
w="full"
63+
<div
64+
className="mb-4 mt-8 flex w-full flex-col rounded border border-body-light bg-feedback-gradient p-6"
7365
{...props}
7466
dir={dir}
7567
>
76-
<Flex direction="column" gap="4">
77-
<Heading as="h3" m="0" mb="2" fontSize="1.375rem" fontWeight="bold">
78-
{getTitle(feedbackSubmitted)}
79-
</Heading>
68+
<div className="flex flex-col gap-4">
69+
<h4 className="mb-2">{getTitle(feedbackSubmitted)}</h4>
8070
{feedbackSubmitted && (
8171
<p>
8272
{t("feedback-widget-thank-you-subtitle")}{" "}
8373
<Translation id="feedback-widget-thank-you-subtitle-ext" />
8474
</p>
8575
)}
86-
<Flex gap="4">
76+
<div className="flex gap-4">
8777
{!feedbackSubmitted ? (
8878
<>
8979
<Button
9080
variant="outline-color"
91-
leftIcon={<FeedbackThumbsUpIcon />}
9281
onClick={() => handleSubmit(true)}
9382
>
83+
<FeedbackThumbsUpIcon />
9484
{t("yes")}
9585
</Button>
9686
<Button
9787
variant="outline-color"
98-
leftIcon={<FeedbackThumbsUpIcon transform="scaleY(-1)" />}
9988
onClick={() => handleSubmit(false)}
10089
>
90+
<FeedbackThumbsUpIcon className="-scale-y-100" />
10191
{t("no")}
10292
</Button>
10393
</>
@@ -106,9 +96,9 @@ const FeedbackCard = ({ prompt, isArticle, ...props }: FeedbackCardProps) => {
10696
{t("feedback-widget-thank-you-cta")}
10797
</Button>
10898
)}
109-
</Flex>
110-
</Flex>
111-
</Flex>
99+
</div>
100+
</div>
101+
</div>
112102
)
113103
}
114104

src/styles/global.css

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,12 +106,13 @@
106106
--tooltip-shadow: rgba(0, 0, 0, 0.24);
107107
--switch-background: var(--gray-300);
108108
--hub-hero-content-bg: rgba(255, 255, 255, 0.8);
109-
--bg-main-gradient: linear-gradient(
109+
--main-gradient: linear-gradient(
110110
102.7deg,
111111
rgba(185, 185, 241, 0.2) 0%,
112112
rgba(84, 132, 234, 0.2) 51.56%,
113113
rgba(58, 142, 137, 0.2) 100%
114114
);
115+
--feedback-gradient: var(--main-gradient);
115116
--table-box-shadow: 0 14px 66px rgba(0, 0, 0, 0.07),
116117
0 10px 17px rgba(0, 0, 0, 0.03), 0 4px 7px rgba(0, 0, 0, 0.05);
117118
--table-item-box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1);
@@ -160,12 +161,18 @@
160161
--tooltip-shadow: rgba(255, 255, 255, 0.24);
161162
--switch-background: rgba(255, 255, 255, 0.24);
162163
--hub-hero-content-bg: rgba(34, 34, 34, 0.8);
163-
--bg-main-gradient: linear-gradient(
164+
--main-gradient: linear-gradient(
164165
102.7deg,
165166
rgba(185, 185, 241, 0.2) 0%,
166167
rgba(84, 132, 234, 0.2) 51.56%,
167168
rgba(58, 142, 137, 0.2) 100%
168169
);
170+
--feedback-gradient: linear-gradient(
171+
83.46deg,
172+
#2c2c32 7.03%,
173+
#44404d 52.42%,
174+
#303038 98.77%
175+
);
169176
--table-box-shadow: 0 14px 66px hsla(0, 0%, 96.1%, 0.07),
170177
0 10px 17px hsla(0, 0%, 96.1%, 0.03), 0 4px 7px hsla(0, 0%, 96.1%, 0.05);
171178
--table-item-box-shadow: 0 1px 1px hsla(0, 0%, 100%, 0.1);

tailwind.config.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,8 @@ const config = {
145145
},
146146
},
147147
backgroundImage: {
148-
"bg-main-gradient": "var(--bg-main-gradient)",
148+
"main-gradient": "var(--main-gradient)",
149+
"feedback-gradient": "var(--feedback-gradient)",
149150
},
150151
boxShadow: {
151152
"table-box": "var(--table-box-shadow)",

tailwind/ui/buttons/Button.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ const buttonVariants = cva(
1616
solid:
1717
"text-background bg-primary border-transparent disabled:bg-disabled disabled:text-background hover:text-background hover:bg-primary-hover hover:shadow-button-hover active:shadow-none",
1818
outline: "hover:shadow-button-hover active:shadow-none",
19+
"outline-color":
20+
"hover:shadow-button-hover active:shadow-none border-primary",
1921
ghost: "border-transparent",
2022
link: "border-transparent font-bold underline py-0 px-1 active:text-primary",
2123
},

0 commit comments

Comments
 (0)