From ba4954b52ae26461cd09a2779ca880ed5ef59ea3 Mon Sep 17 00:00:00 2001 From: "m.ray" <16125548+MadalinaRaicu@users.noreply.github.com> Date: Mon, 8 Aug 2022 20:09:46 +0200 Subject: [PATCH] feat: multi open accordion (#963) * feat: 744 multi open accordion but not using pixelated icon anymore * fix: fix size of the icon and color * fix: remove styled stitches * fix: remove styled stitches --- .../src/components/accordion/accordion.tsx | 31 +++++++++++++------ .../src/components/accordion/chevron-down.tsx | 31 ------------------- 2 files changed, 22 insertions(+), 40 deletions(-) delete mode 100644 libs/ui-toolkit/src/components/accordion/chevron-down.tsx diff --git a/libs/ui-toolkit/src/components/accordion/accordion.tsx b/libs/ui-toolkit/src/components/accordion/accordion.tsx index 01cb45d64..0f4a101e2 100644 --- a/libs/ui-toolkit/src/components/accordion/accordion.tsx +++ b/libs/ui-toolkit/src/components/accordion/accordion.tsx @@ -1,7 +1,7 @@ import React, { useState } from 'react'; import * as AccordionPrimitive from '@radix-ui/react-accordion'; -import ChevronDownIcon from './chevron-down'; import classNames from 'classnames'; +import { ChevronDownIcon } from '@radix-ui/react-icons'; export interface AccordionItemProps { title: React.ReactNode; @@ -13,21 +13,20 @@ export interface AccordionProps { } export const Accordion = ({ panels }: AccordionProps) => { - const [value, setValue] = useState(''); + const [values, setValues] = useState([]); const triggerClassNames = classNames( 'w-full py-2 box-border', 'appearance-none cursor-pointer focus:outline-none', 'flex items-center justify-between border-b border-muted', - 'text-left' + 'text-left text-black dark:text-white' ); return ( {panels.map(({ title, content }, i) => ( @@ -37,12 +36,15 @@ export const Accordion = ({ panels }: AccordionProps) => { className={triggerClassNames} >

{title}

- + {
); }; + +export const AccordionChevron = ({ active }: { active: boolean }) => { + return ( + + ); +}; diff --git a/libs/ui-toolkit/src/components/accordion/chevron-down.tsx b/libs/ui-toolkit/src/components/accordion/chevron-down.tsx deleted file mode 100644 index 70e2e0c80..000000000 --- a/libs/ui-toolkit/src/components/accordion/chevron-down.tsx +++ /dev/null @@ -1,31 +0,0 @@ -export const ChevronDownIcon = ({ active }: ChevronDownIconProps) => { - const rotate = active - ? 'transform duration-300 ease rotate-180' - : 'transform duration-300 ease'; - return ( - - - - - - - - - - ); -}; - -export interface ChevronDownIconProps { - active: boolean; -} - -export default ChevronDownIcon;