diff --git a/src/components/recommendation-tag/recommendation-tag.stories.tsx b/src/components/featured-tag/featured-tag.stories.tsx similarity index 78% rename from src/components/recommendation-tag/recommendation-tag.stories.tsx rename to src/components/featured-tag/featured-tag.stories.tsx index ee216287..5700c838 100644 --- a/src/components/recommendation-tag/recommendation-tag.stories.tsx +++ b/src/components/featured-tag/featured-tag.stories.tsx @@ -1,17 +1,17 @@ import type { Meta, StoryObj } from "@storybook/react"; import React, { useState } from "react"; -import { RecommendationTag } from "./recommendation-tag"; +import { FeaturedTag } from "./featured-tag"; import { Panel } from "../panel"; import { FormField } from "../form-field"; -const meta: Meta = { - title: "Input/RecommendationTag", - component: RecommendationTag, +const meta: Meta = { + title: "Input/FeaturedTag", + component: FeaturedTag, }; export default meta; -type Story = StoryObj; +type Story = StoryObj; const RadioBoxWithRecommendationTag = () => { const [value, setValue] = useState("value_1"); @@ -27,7 +27,7 @@ const RadioBoxWithRecommendationTag = () => { id="value" > - Option 1Recommended! + Option 1Recommended! Option 2 @@ -50,7 +50,7 @@ export const PanelExample: Story = {

This example uses a Panel component

- Recommended! + Recommended!
), diff --git a/src/components/recommendation-tag/recommendation-tag.tsx b/src/components/featured-tag/featured-tag.tsx similarity index 51% rename from src/components/recommendation-tag/recommendation-tag.tsx rename to src/components/featured-tag/featured-tag.tsx index ac77efdf..5fbb81ee 100644 --- a/src/components/recommendation-tag/recommendation-tag.tsx +++ b/src/components/featured-tag/featured-tag.tsx @@ -1,16 +1,16 @@ import React, { ReactNode } from "react"; import { classNames } from "../../util/class-names"; -interface RecommendationTagProps { +interface FeaturedTagProps { children: ReactNode; className?: string; } -export const RecommendationTag = ({ children, className }: RecommendationTagProps) => { +export const FeaturedTag = ({ children, className }: FeaturedTagProps) => { return ( diff --git a/src/components/form-field/radio-box/radio-box-option.tsx b/src/components/form-field/radio-box/radio-box-option.tsx index f81d8cab..1f715b46 100644 --- a/src/components/form-field/radio-box/radio-box-option.tsx +++ b/src/components/form-field/radio-box/radio-box-option.tsx @@ -1,83 +1,79 @@ import { RadioGroup } from "@headlessui/react"; -import React from "react"; +import React, { Fragment } from "react"; import { classNames } from "../../../util/class-names"; -import { RecommendationTag } from "../../recommendation-tag/recommendation-tag"; export interface RadioBoxOptionProps { children: React.ReactNode; value: string; disabled?: boolean; - recommendationText?: string; className?: string; } -export const radioBoxContainerStyles = { - base: "group relative flex items-center gap-3 rounded-lg bg-neutral-0 border p-4 border-neutral-300 hover:border-primary-500 hover:bg-primary-50", - checked: "border-primary-500 bg-primary-500 hover:bg-primary-500 hover:text-neutral-0", +const radioBoxContainerStyles = { + base: "group relative flex items-center gap-3 rounded-lg bg-neutral-0 border p-4 border-neutral-300 hover:border-primary-600 hover:bg-primary-50 cursor-pointer focus:outline-none", + checked: "border-primary-600 bg-primary-600 hover:bg-primary-600 hover:text-neutral-0", disabled: - "border-neutral-400 bg-neutral-100 group-hover:border-neutral-400 group-hover:bg-neutral-100 hover:border-neutral-400 hover:bg-neutral-100", + "bg-neutral-100 group-hover:border-neutral-300 group-hover:bg-neutral-100 hover:border-neutral-300 hover:bg-neutral-100 cursor-not-allowed", + active: "ring-2 ring-primary-200", }; -export const radioBoxCircleStyles = { - base: "relative inline-block h-4 w-4 shrink-0 rounded-full bg-neutral-0 border border-neutral-400", - unchecked: "group-hover:border-primary-500 group-hover:bg-neutral-0", - disabled: "bg-neutral-100 group-hover:border-neutral-400 group-hover:bg-neutral-100", +const radioBoxCircleStyles = { + base: "relative inline-block h-4 w-4 shrink-0 rounded-full bg-neutral-0 border border-neutral-300", + unchecked: "group-hover:border-primary-600 group-hover:bg-neutral-0", + checked: "border-transparent", + disabled: + "bg-neutral-200 border-neutral-200 group-hover:border-neutral-200 group-hover:bg-neutral-200", }; -export const RadioBoxOption = ({ - children, - value, - disabled, - recommendationText, - className, -}: RadioBoxOptionProps) => { +const Title = ({ children }: { children: React.ReactNode }) => ( +

+ {children} +

+); + +const Description = ({ children }: { children: React.ReactNode }) => ( +

+ {children} +

+); + +export const RadioBoxOption = ({ children, value, disabled, className }: RadioBoxOptionProps) => { return ( - - {({ checked, disabled: optionDisabled }) => ( + + {({ checked, disabled: optionDisabled, active }) => (
- {recommendationText && ( - {recommendationText} - )} -
{checked && (
)}
-
- {children} -
+
{children}
)} ); }; + +RadioBoxOption.Title = Title; +RadioBoxOption.Description = Description; diff --git a/src/components/form-field/radio-box/radio-box.stories.tsx b/src/components/form-field/radio-box/radio-box.stories.tsx index 68315901..ce4203fe 100644 --- a/src/components/form-field/radio-box/radio-box.stories.tsx +++ b/src/components/form-field/radio-box/radio-box.stories.tsx @@ -2,6 +2,7 @@ import type { Meta, StoryObj } from "@storybook/react"; import React, { useState } from "react"; import { FormField } from "../form-field"; import { RadioBox } from "./radio-box"; +import { FeaturedTag } from "../../featured-tag/featured-tag"; const meta: Meta = { title: "Input/RadioBox", @@ -18,34 +19,33 @@ const RadioBoxWithHooks = () => { return ( - -
-

Option 1

-

- To be, or not to be, that is the question: Whether ’tis nobler in the - mind to suffer The slings and arrows of outrageous fortune, … -

-
+ + Recommended + + Option 1 + + + To be, or not to be, that is the question: Whether ’tis nobler in the mind + to suffer The slings and arrows of outrageous fortune, … + -
-

Option 2

-

- To be, or not to be, that is the question: Whether ’tis nobler in the - mind to suffer The slings and arrows of outrageous fortune, … -

-
+ Option 2 + + + To be, or not to be, that is the question: Whether ’tis nobler in the mind + to suffer The slings and arrows of outrageous fortune, … +
-
-

Option 3

-

- To be, or not to be, that is the question: Whether ’tis nobler in the - mind to suffer The slings and arrows of outrageous fortune, … -

-
+ Option 3 + + + To be, or not to be, that is the question: Whether ’tis nobler in the mind + to suffer The slings and arrows of outrageous fortune, … +