From a6ff5eee45215effb3344cb5d631a27a7c0369aa Mon Sep 17 00:00:00 2001 From: Armand Philippot Date: Fri, 22 Sep 2023 19:34:01 +0200 Subject: refactor(components): rewrite form components --- src/components/molecules/modals/tooltip.tsx | 67 ----------------------------- 1 file changed, 67 deletions(-) delete mode 100644 src/components/molecules/modals/tooltip.tsx (limited to 'src/components/molecules/modals/tooltip.tsx') diff --git a/src/components/molecules/modals/tooltip.tsx b/src/components/molecules/modals/tooltip.tsx deleted file mode 100644 index 3c8a5df..0000000 --- a/src/components/molecules/modals/tooltip.tsx +++ /dev/null @@ -1,67 +0,0 @@ -import { forwardRef, ForwardRefRenderFunction, ReactNode } from 'react'; -import { List, type ListItem } from '../../atoms'; -import styles from './tooltip.module.scss'; - -export type TooltipProps = { - /** - * Set additional classnames to the tooltip wrapper. - */ - className?: string; - /** - * Set more additional classnames to the tooltip wrapper. Required when using React.cloneElement. - */ - cloneClassName?: string; - /** - * The tooltip body. - */ - content: string | string[]; - /** - * An icon to illustrate tooltip content. - */ - icon: ReactNode; - /** - * The tooltip title. - */ - title: string; -}; - -const TooltipWithRef: ForwardRefRenderFunction = ( - { cloneClassName = '', className = '', content, icon, title }, - ref -) => { - /** - * Format an array of strings to an array of object with id and value. - * - * @param {string[]} array - An array of strings. - * @returns {ListItem[]} The array formatted to be used as list items. - */ - const getListItems = (array: string[]): ListItem[] => { - return array.map((string, index) => { - return { id: `item-${index}`, value: string }; - }); - }; - - return ( -
-
- {icon} - {title} -
- {Array.isArray(content) ? ( - - ) : ( - content - )} -
- ); -}; - -/** - * Tooltip component - * - * Render a tooltip modal. - */ -export const Tooltip = forwardRef(TooltipWithRef); -- cgit v1.2.3