Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shadcn migration - feedback card #13629

Merged
merged 3 commits into from
Aug 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 13 additions & 23 deletions src/components/FeedbackCard.tsx
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
import { type ReactNode, useState } from "react"
import { useRouter } from "next/router"
import { useTranslation } from "next-i18next"
import { Flex, type FlexProps, Heading } from "@chakra-ui/react"

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

import { Button } from "@/components/Buttons"
import { FeedbackThumbsUpIcon } from "@/components/icons"

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

import { Button } from "../../tailwind/ui/buttons/Button"

import Translation from "./Translation"

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

type FeedbackCardProps = FlexProps & {
type FeedbackCardProps = {
prompt?: string
isArticle?: boolean
}
Expand Down Expand Up @@ -60,44 +60,34 @@ const FeedbackCard = ({ prompt, isArticle, ...props }: FeedbackCardProps) => {
}

return (
<Flex
border="1px"
borderColor="border"
bg="feedbackGradient"
borderRadius="base"
p="6"
direction="column"
mb="4"
mt="8"
w="full"
<div
className="mb-4 mt-8 flex w-full flex-col rounded border border-body-light bg-feedback-gradient p-6"
{...props}
dir={dir}
>
<Flex direction="column" gap="4">
<Heading as="h3" m="0" mb="2" fontSize="1.375rem" fontWeight="bold">
{getTitle(feedbackSubmitted)}
</Heading>
<div className="flex flex-col gap-4">
<h4 className="mb-2">{getTitle(feedbackSubmitted)}</h4>
{feedbackSubmitted && (
<p>
{t("feedback-widget-thank-you-subtitle")}{" "}
<Translation id="feedback-widget-thank-you-subtitle-ext" />
</p>
)}
<Flex gap="4">
<div className="flex gap-4">
{!feedbackSubmitted ? (
<>
<Button
variant="outline-color"
leftIcon={<FeedbackThumbsUpIcon />}
onClick={() => handleSubmit(true)}
>
<FeedbackThumbsUpIcon className="h-6 w-6" />
{t("yes")}
</Button>
<Button
variant="outline-color"
leftIcon={<FeedbackThumbsUpIcon transform="scaleY(-1)" />}
onClick={() => handleSubmit(false)}
>
<FeedbackThumbsUpIcon className="-scale-y-100" />
{t("no")}
</Button>
</>
Expand All @@ -106,9 +96,9 @@ const FeedbackCard = ({ prompt, isArticle, ...props }: FeedbackCardProps) => {
{t("feedback-widget-thank-you-cta")}
</Button>
)}
</Flex>
</Flex>
</Flex>
</div>
</div>
</div>
)
}

Expand Down
1 change: 0 additions & 1 deletion src/components/MeetupList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import {
LinkOverlay,
List,
ListItem,
useColorModeValue,
useToken,
VisuallyHidden,
} from "@chakra-ui/react"
Expand Down
22 changes: 0 additions & 22 deletions src/components/icons/FeedbackThumbsUpIcon.tsx

This file was deleted.

2 changes: 1 addition & 1 deletion src/components/icons/Icons.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Center, Flex, Icon, SimpleGrid } from "@chakra-ui/react"
import type { Meta, StoryObj } from "@storybook/react"

import { EthHomeIcon } from "./EthHomeIcon"
import { FeedbackThumbsUpIcon } from "./FeedbackThumbsUpIcon"
import FeedbackThumbsUpIcon from "./feedback-thumbs-up-icon.svg"
import { HighlightDarkIcon } from "./HighlightDarkIcon"
import { HighlightIcon } from "./HighlightIcon"
import {
Expand Down
14 changes: 14 additions & 0 deletions src/components/icons/feedback-thumbs-up-icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/components/icons/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// General Icons
import { EthHomeIcon } from "./EthHomeIcon"
import FeedbackGlyphIcon from "./feedback-glyph-icon.svg"
import { FeedbackThumbsUpIcon } from "./FeedbackThumbsUpIcon"
import FeedbackThumbsUpIcon from "./feedback-thumbs-up-icon.svg"
import { HighlightDarkIcon } from "./HighlightDarkIcon"
import { HighlightIcon } from "./HighlightIcon"

Expand Down
2 changes: 2 additions & 0 deletions src/components/ui/buttons/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ const buttonVariants = cva(
solid:
"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",
outline: "hover:shadow-button-hover active:shadow-none",
"outline-color":
"hover:shadow-button-hover active:shadow-none border-primary",
ghost: "border-transparent",
link: "border-transparent font-bold underline py-0 px-1 active:text-primary",
},
Expand Down
11 changes: 9 additions & 2 deletions src/styles/global.css
Original file line number Diff line number Diff line change
Expand Up @@ -106,12 +106,13 @@
--tooltip-shadow: rgba(0, 0, 0, 0.24);
--switch-background: var(--gray-300);
--hub-hero-content-bg: rgba(255, 255, 255, 0.8);
--bg-main-gradient: linear-gradient(
--main-gradient: linear-gradient(
102.7deg,
rgba(185, 185, 241, 0.2) 0%,
rgba(84, 132, 234, 0.2) 51.56%,
rgba(58, 142, 137, 0.2) 100%
);
--feedback-gradient: var(--main-gradient);
--table-box-shadow: 0 14px 66px rgba(0, 0, 0, 0.07),
0 10px 17px rgba(0, 0, 0, 0.03), 0 4px 7px rgba(0, 0, 0, 0.05);
--table-item-box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1);
Expand Down Expand Up @@ -160,12 +161,18 @@
--tooltip-shadow: rgba(255, 255, 255, 0.24);
--switch-background: rgba(255, 255, 255, 0.24);
--hub-hero-content-bg: rgba(34, 34, 34, 0.8);
--bg-main-gradient: linear-gradient(
--main-gradient: linear-gradient(
102.7deg,
rgba(185, 185, 241, 0.2) 0%,
rgba(84, 132, 234, 0.2) 51.56%,
rgba(58, 142, 137, 0.2) 100%
);
--feedback-gradient: linear-gradient(
83.46deg,
#2c2c32 7.03%,
#44404d 52.42%,
#303038 98.77%
);
--table-box-shadow: 0 14px 66px hsla(0, 0%, 96.1%, 0.07),
0 10px 17px hsla(0, 0%, 96.1%, 0.03), 0 4px 7px hsla(0, 0%, 96.1%, 0.05);
--table-item-box-shadow: 0 1px 1px hsla(0, 0%, 100%, 0.1);
Expand Down
3 changes: 2 additions & 1 deletion tailwind.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,8 @@ const config = {
},
},
backgroundImage: {
"main-gradient": "var(--bg-main-gradient)",
"main-gradient": "var(--main-gradient)",
"feedback-gradient": "var(--feedback-gradient)",
},
boxShadow: {
"table-box": "var(--table-box-shadow)",
Expand Down
Loading