From 12a03a9a72f7895d571dbaeeb245d92aa277a610 Mon Sep 17 00:00:00 2001 From: Armand Philippot Date: Fri, 6 Oct 2023 17:48:03 +0200 Subject: refactor(components): merge HeadingButton and Widget components The HeadingButton component was only used inside Widget component and it is not very useful on its own so I merge the two components in a new Collapsible component. --- src/components/organisms/widgets/sharing.tsx | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) (limited to 'src/components/organisms/widgets/sharing.tsx') diff --git a/src/components/organisms/widgets/sharing.tsx b/src/components/organisms/widgets/sharing.tsx index eeffb71..47ec49d 100644 --- a/src/components/organisms/widgets/sharing.tsx +++ b/src/components/organisms/widgets/sharing.tsx @@ -1,7 +1,7 @@ import type { FC } from 'react'; import { useIntl } from 'react-intl'; -import { SharingLink, type SharingMedium } from '../../atoms'; -import { Widget, type WidgetProps } from '../../molecules'; +import { Heading, SharingLink, type SharingMedium } from '../../atoms'; +import { Collapsible, type CollapsibleProps } from '../../molecules'; import styles from './sharing.module.scss'; /** @@ -80,7 +80,7 @@ export type SharingData = { url: string; }; -export type SharingProps = { +export type SharingProps = Omit & { /** * Set additional classnames to the sharing links list. */ @@ -89,14 +89,6 @@ export type SharingProps = { * The page data to share. */ data: SharingData; - /** - * The widget default state. - */ - expanded?: WidgetProps['expanded']; - /** - * The HTML heading level. - */ - level?: WidgetProps['level']; /** * A list of active and ordered sharing medium. */ @@ -112,8 +104,6 @@ export const Sharing: FC = ({ className = '', data, media, - expanded = true, - level = 2, ...props }) => { const listClass = `${styles.list} ${className}`; @@ -255,8 +245,15 @@ export const Sharing: FC = ({ )); return ( - + + {widgetTitle} + + } + >
    {getItems()}
-
+ ); }; -- cgit v1.2.3