From 1f42ad2a2dd58640485bc7cca1bc01a045a0d744 Mon Sep 17 00:00:00 2001 From: jnsdls Date: Thu, 29 May 2025 21:25:21 +0000 Subject: [PATCH] [Dashboard] migrate SelectOption to shadcn (#7194) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Migrated the `SelectOption` component in the dashboard batch upload flow to use shadcn/ui primitives and Tailwind classes. - Replaced Chakra `Tooltip`, `Flex`, and `Radio` usage with `ToolTipLabel` and Tailwind markup - Switched to shadcn/ui `Card` - Removed dependency on Chakra typography components - Updated component props to extend HTML attributes Fixes migration step towards removing Chakra. --- ## PR-Codex overview This PR updates the `SelectOption` component to improve its structure and styling. It replaces the `Tooltip` from `@chakra-ui/react` with a custom `ToolTipLabel`, modifies the layout and styling, and enhances the handling of props. ### Detailed summary - Changed `SelectOptionProps` to extend `React.HTMLAttributes`. - Replaced `Tooltip` with `ToolTipLabel`. - Updated the card styling and structure. - Modified the layout for `Radio` to a custom implementation. - Adjusted class names for better styling consistency. - Changed the rendering of `name` and `description` to use HTML elements directly. > ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}` ## Summary by CodeRabbit - **Refactor** - Updated the selection option component with custom UI elements and Tailwind CSS styling, removing dependencies on Chakra UI and previous component libraries. - Improved accessibility and styling for tooltips, cards, and selection indicators. - Maintained original functionality and interactions with a refreshed look and feel. --- .../lazy-mint-form/select-option.tsx | 98 +++++++------------ 1 file changed, 38 insertions(+), 60 deletions(-) diff --git a/apps/dashboard/src/core-ui/batch-upload/lazy-mint-form/select-option.tsx b/apps/dashboard/src/core-ui/batch-upload/lazy-mint-form/select-option.tsx index 5eb8f1e6699..fe89f4c366d 100644 --- a/apps/dashboard/src/core-ui/batch-upload/lazy-mint-form/select-option.tsx +++ b/apps/dashboard/src/core-ui/batch-upload/lazy-mint-form/select-option.tsx @@ -1,10 +1,10 @@ +import { Card } from "@/components/ui/card"; +import { ToolTipLabel } from "@/components/ui/tooltip"; import { cn } from "@/lib/utils"; -import { Flex, Radio, Tooltip } from "@chakra-ui/react"; import { InfoIcon } from "lucide-react"; import type { JSX, MouseEventHandler } from "react"; -import { Card, Heading, Text } from "tw-components"; -interface SelectOptionProps { +interface SelectOptionProps extends React.HTMLAttributes { name: string; description?: string; isActive?: boolean; @@ -24,84 +24,62 @@ export const SelectOption: React.FC = ({ disabledText, infoText, className, - ...stackProps + ...divProps }) => { return ( - - {disabledText} + disabled ? ( + +

{disabledText}

- ) + ) : undefined } - bg="transparent" - boxShadow="none" - p={0} - shouldWrapChildren > - -
- +
+
+
+ {isActive &&
} +
- {name} - - {description && ( - - {description} - - )} + + {description &&

{description}

}
{infoText && ( -
- - {infoText} - - } - > - - - - -
+ +

{infoText}

+ + } + > +
+ +
+
)} - +
- + ); };