From 0716536225320f6a51bc2d32ef6b6004073d7493 Mon Sep 17 00:00:00 2001
From: saurabhburade
Date: Mon, 30 Sep 2024 19:29:22 +0530
Subject: [PATCH 1/3] feat: migrate BugBountyCards to tailwind
---
src/components/BugBountyCards.tsx | 155 ++++++++++--------------------
1 file changed, 53 insertions(+), 102 deletions(-)
diff --git a/src/components/BugBountyCards.tsx b/src/components/BugBountyCards.tsx
index 011668ddb15..e3e57785d85 100644
--- a/src/components/BugBountyCards.tsx
+++ b/src/components/BugBountyCards.tsx
@@ -1,105 +1,67 @@
+import { BaseHTMLAttributes } from "react"
import { useTranslation } from "next-i18next"
-import {
- Box,
- type BoxProps,
- Center,
- type CenterProps,
- Divider,
- Flex,
- type FlexProps,
- Heading,
- type HeadingProps,
- type TextProps,
- useToken,
-} from "@chakra-ui/react"
import type { ChildOnlyProp, TranslationKey } from "@/lib/types"
-import { ButtonLink, type ButtonLinkProps } from "@/components/Buttons"
-import Text from "@/components/OldText"
+import { cn } from "@/lib/utils/cn"
+
+import { ButtonLink, ButtonLinkProps } from "./ui/buttons/Button"
+import { Center, Flex, Stack } from "./ui/flex"
+
+type FlexProps = BaseHTMLAttributes
const CardRow = ({ children }: ChildOnlyProp) => (
-
- {children}
-
+ {children}
)
const SubmitBugBountyButton = ({ children, ...props }: ButtonLinkProps) => (
-
+
{children}
)
const Card = ({ children, ...props }: FlexProps) => {
- const tableBoxShadow = useToken("colors", "tableBoxShadow")
-
return (
-
{children}
-
+
)
}
type LabelVariant = "low" | "medium" | "high" | "critical"
-type LabelProps = CenterProps & {
+type LabelProps = FlexProps & {
variant: LabelVariant
}
-const stylePropsByVariant = {
- low: {
- bg: "lowBug",
- color: "black300",
- },
- medium: {
- bg: "mediumBug",
- color: "black300",
- },
- high: {
- bg: "fail400",
- color: "white",
- },
- critical: {
- bg: "fail600",
- color: "white",
- },
+const classNameByVariant = {
+ low: "bg-[#ffe3d3] text-[#333]",
+ medium: "bg-[#ffab7b] text-[#333]",
+ high: "bg-[#c63333] text-white",
+ critical: "bg-[#930000] text-white",
}
const Label = ({ children, variant = "medium", ...props }: LabelProps) => {
- const variantStyleProps = stylePropsByVariant[variant]
+ const variantClassName = classNameByVariant[variant]
return (
{children}
@@ -107,48 +69,37 @@ const Label = ({ children, variant = "medium", ...props }: LabelProps) => {
)
}
-const H2 = ({ children, ...props }: HeadingProps) => (
- (
+
{children}
-
+
)
-const Description = ({ children, ...props }: TextProps) => (
-
+const Description = ({ children, ...props }) => (
+
{children}
-
+
)
-const SubHeader = ({ children, ...props }: TextProps) => (
-
+const SubHeader = ({ children, ...props }) => (
+
{children}
-
+
)
-const TextBox = ({ children, ...props }: BoxProps) => (
-
+const TextBox = ({
+ children,
+ ...props
+}: BaseHTMLAttributes) => (
+
{children}
-
+
)
export interface BugBountyCardInfo {
@@ -246,7 +197,7 @@ const BugBountyCards = () => {
{t(card.h2TranslationId)}
{t(card.descriptionTranslationId)}
{t(card.subDescriptionTranslationId)}
-
+
{t(card.subHeader1TranslationId)}
@@ -258,7 +209,7 @@ const BugBountyCards = () => {
))}
-
+
{t(card.subHeader2TranslationId)}
{t(card.textTranslationId)}
From 9c28275d54aaa7d3c6aad3bf2263508c19afc747 Mon Sep 17 00:00:00 2001
From: saurabhburade
Date: Wed, 2 Oct 2024 22:26:32 +0530
Subject: [PATCH 2/3] chore: update with suggested changes
---
src/components/BugBountyCards.tsx | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
diff --git a/src/components/BugBountyCards.tsx b/src/components/BugBountyCards.tsx
index e3e57785d85..8e8da796947 100644
--- a/src/components/BugBountyCards.tsx
+++ b/src/components/BugBountyCards.tsx
@@ -30,8 +30,8 @@ const Card = ({ children, ...props }: FlexProps) => {
className={cn(
"flex-[1_1_412px] gap-0 xl:flex-[1_1_216px]",
"m-4 justify-between bg-background",
- "rounded-sm border border-[#e5e5e5] shadow-table-box dark:border-[#333]",
- "hover:scale-[1.02] hover:rounded hover:bg-[#f2f2f2] hover:shadow-table-box-hover hover:transition-transform hover:duration-100 dark:hover:bg-[rgba(255,115,36,.013)]"
+ "rounded-sm border shadow-table-box",
+ "hover:scale-[1.02] hover:rounded hover:bg-background-highlight hover:shadow-table-box-hover hover:transition-transform hover:duration-100"
)}
{...props}
>
@@ -59,7 +59,7 @@ const Label = ({ children, variant = "medium", ...props }: LabelProps) => {
return (
{
const H2 = ({ children, ...props }) => (
{children}
From 1fb841a34d50341bbdfc733fffb8c3874d51b02a Mon Sep 17 00:00:00 2001
From: Nuno Loureiro
Date: Wed, 23 Oct 2024 06:11:53 +0100
Subject: [PATCH 3/3] Update src/components/BugBountyCards.tsx
I like it
Co-authored-by: Paul Wackerow <54227730+wackerow@users.noreply.github.com>
---
src/components/BugBountyCards.tsx | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/components/BugBountyCards.tsx b/src/components/BugBountyCards.tsx
index 8e8da796947..fb017ea3611 100644
--- a/src/components/BugBountyCards.tsx
+++ b/src/components/BugBountyCards.tsx
@@ -47,10 +47,10 @@ type LabelProps = FlexProps & {
}
const classNameByVariant = {
- low: "bg-[#ffe3d3] text-[#333]",
- medium: "bg-[#ffab7b] text-[#333]",
- high: "bg-[#c63333] text-white",
- critical: "bg-[#930000] text-white",
+ low: "bg-red-100 text-black",
+ medium: "bg-red-300 text-black",
+ high: "bg-red-700 text-white",
+ critical: "bg-red-900 text-white",
}
const Label = ({ children, variant = "medium", ...props }: LabelProps) => {