diff --git a/libs/blocks/src/lib/accordion/accordion.spec.tsx b/libs/blocks/src/lib/accordion/accordion.spec.tsx index 81c83190f..a627337ff 100644 --- a/libs/blocks/src/lib/accordion/accordion.spec.tsx +++ b/libs/blocks/src/lib/accordion/accordion.spec.tsx @@ -29,7 +29,6 @@ describe('AccordionBlock', () => { it('renders with correct class names and content', () => { const className = 'text-heading-h2'; const title = 'Title goes here'; - const childClassName = 'text-heading-h6'; const { getByText } = render( { //renders with the correct title expect(getByText(title)).toBeInTheDocument(); - const childTitleElement = getByText(childTitle); - - //renders with correct classname - expect(childTitleElement).toHaveClass(childClassName); - //renders with the correct title expect(getByText(subTitle)).toBeInTheDocument(); }); diff --git a/libs/components/src/lib/accordion/base/index.tsx b/libs/components/src/lib/accordion/base/index.tsx index b6b8b7f27..b6836723f 100644 --- a/libs/components/src/lib/accordion/base/index.tsx +++ b/libs/components/src/lib/accordion/base/index.tsx @@ -1,9 +1,10 @@ import styles from './base.module.css'; -import { Heading, qtMerge, Text } from '@deriv/quill-design'; +import { qtMerge, Text } from '@deriv/quill-design'; import { AccordionProps } from '../types'; import { StandaloneChevronDownRegularIcon } from '@deriv/quill-icons/Standalone'; import { useCallback, useEffect, useRef, useState } from 'react'; +import clsx from 'clsx'; export const Base = ({ id, @@ -14,6 +15,7 @@ export const Base = ({ expanded = false, icon, divider = 'none', + background = 'light', customContent: CustomContent, contentClass, onExpand, @@ -33,6 +35,11 @@ export const Base = ({ } }; + const bgColorVariantClass = { + light: 'bg-background-primary-container', + gray: 'bg-background-primary-base', + }; + const dividerClassNames = { both: 'border-x-none border-b-opacity-black-100 border-t-opacity-black-100 border-100', bottom: 'border-b-opacity-black-100 !border-t-none border-100', @@ -114,7 +121,9 @@ export const Base = ({ <> {icon &&
{icon}
}
- {title} + + {title} + {subtitle && ( {(isAutoExpand || isExpanded) && ( -
+
{Content && }
)} diff --git a/libs/components/src/lib/accordion/types/index.ts b/libs/components/src/lib/accordion/types/index.ts index e3861975a..39ab5a408 100644 --- a/libs/components/src/lib/accordion/types/index.ts +++ b/libs/components/src/lib/accordion/types/index.ts @@ -11,7 +11,8 @@ export interface AccordionProps { customContent?: () => ReactNode; divider?: AccordionDivider; contentClass?: string; + background?: BgVariant; onExpand?: (e: boolean, i: string) => void; } - +export type BgVariant = 'light' | 'gray'; export type AccordionDivider = 'none' | 'both' | 'bottom';