From 41072d17f763a8b801374481065c83823da85a1f Mon Sep 17 00:00:00 2001 From: Likhith Kolayari Date: Thu, 25 Apr 2024 08:37:32 +0400 Subject: [PATCH 1/2] chore: added icon support for Accordion-title --- src/components/Accordion/index.tsx | 2 +- stories/Accordion.stories.tsx | 22 +++++++++++++++++++++- stories/mock/brand-deriv-logo.svg | 1 + 3 files changed, 23 insertions(+), 2 deletions(-) create mode 100644 stories/mock/brand-deriv-logo.svg diff --git a/src/components/Accordion/index.tsx b/src/components/Accordion/index.tsx index 3c8361ef..d72c6c5b 100644 --- a/src/components/Accordion/index.tsx +++ b/src/components/Accordion/index.tsx @@ -9,7 +9,7 @@ type AccordionProps = { children: ReactNode; defaultOpen?: boolean; isCompact?: boolean; - title: string; + title: string | JSX.Element; variant?: AccordionVariants; }; diff --git a/stories/Accordion.stories.tsx b/stories/Accordion.stories.tsx index a4b1b925..4a34a0ca 100644 --- a/stories/Accordion.stories.tsx +++ b/stories/Accordion.stories.tsx @@ -1,5 +1,6 @@ import type { Meta, StoryObj } from "@storybook/react"; import { Accordion } from "../src/main"; +import DerivBrandLogo from "./mock/brand-deriv-logo.svg"; const meta = { title: "Components/Accordion", @@ -17,7 +18,6 @@ const meta = { variant: "underline", }, argTypes: { - title: { control: { type: "text" } }, defaultOpen: { control: { type: "boolean" } }, variant: { options: ["underline", "bordered", "shadow"], @@ -67,6 +67,26 @@ export const Bordered: Story = { ), }; +export const BorderedWithIcons: Story = { + args: { + variant: "bordered", + title: ( +
+ + What is your return policy? +
+ ), + }, + render: (args) => ( +
+ + Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do + eiusmod tempor incididunt ut labore et dolore magna aliqua. + +
+ ), +}; + export const Shadow: Story = { args: { variant: "shadow", diff --git a/stories/mock/brand-deriv-logo.svg b/stories/mock/brand-deriv-logo.svg new file mode 100644 index 00000000..483a2670 --- /dev/null +++ b/stories/mock/brand-deriv-logo.svg @@ -0,0 +1 @@ + \ No newline at end of file From 7877f8f22f4e85d43fc89ef920d66432e8447238 Mon Sep 17 00:00:00 2001 From: Likhith Kolayari Date: Thu, 25 Apr 2024 10:15:57 +0400 Subject: [PATCH 2/2] fix: incorporated review comments --- src/components/Accordion/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/Accordion/index.tsx b/src/components/Accordion/index.tsx index d72c6c5b..98a53101 100644 --- a/src/components/Accordion/index.tsx +++ b/src/components/Accordion/index.tsx @@ -51,7 +51,7 @@ export const Accordion = ({ onClick={toggleAccordion} aria-expanded={active} > -

{title}

+ {typeof title === "string" ?

{title}

: title}