From 2b387f6121ef35011da75ca6f410b2b0bc78830e Mon Sep 17 00:00:00 2001 From: Joseph Izang Date: Mon, 31 Oct 2022 12:04:20 +0100 Subject: [PATCH] add custom tooltips to file explorer --- .../src/lib/components/file-explorer-menu.tsx | 38 ++++++++----------- .../src/lib/components/file-label.tsx | 19 +++++++--- 2 files changed, 29 insertions(+), 28 deletions(-) diff --git a/libs/remix-ui/workspace/src/lib/components/file-explorer-menu.tsx b/libs/remix-ui/workspace/src/lib/components/file-explorer-menu.tsx index 45b293381b..49fc4393ce 100644 --- a/libs/remix-ui/workspace/src/lib/components/file-explorer-menu.tsx +++ b/libs/remix-ui/workspace/src/lib/components/file-explorer-menu.tsx @@ -1,5 +1,5 @@ +import { CustomTooltip } from '@remix-ui/helper' import React, { useState, useEffect } from 'react' //eslint-disable-line -import { OverlayTrigger, Tooltip } from 'react-bootstrap' import { Placement } from 'react-bootstrap/esm/Overlay' import { FileExplorerMenuProps } from '../types' const _paq = window._paq = window._paq || [] @@ -53,27 +53,23 @@ export const FileExplorerMenu = (props: FileExplorerMenuProps) => { return ( <> - - {props.title} - - } + tooltipId="remixuilabelTooltip" + tooltipClasses="text-nowrap" + tooltipText={props.title} > { props.title } - + { state.menuItems.map(({ action, title, icon, placement }, index) => { if (action === 'uploadFile') { return ( - - {title} - - } + tooltipId="uploadFileTooltip" + tooltipClasses="text-nowrap" + tooltipText={title} > - + ) } else { return ( - - {title} - - } + tooltipId={`${action}-${title}-${icon}-${index}`} + tooltipClasses="text-nowrap" + tooltipText={title} > { key={`${action}-${title}-${index}`} > - + ) } })} diff --git a/libs/remix-ui/workspace/src/lib/components/file-label.tsx b/libs/remix-ui/workspace/src/lib/components/file-label.tsx index 94d53f8a8c..49563979ea 100644 --- a/libs/remix-ui/workspace/src/lib/components/file-label.tsx +++ b/libs/remix-ui/workspace/src/lib/components/file-label.tsx @@ -1,5 +1,6 @@ // eslint-disable-next-line no-use-before-define import { fileDecoration } from '@remix-ui/file-decorators' +import { CustomTooltip } from '@remix-ui/helper' import React, { useEffect, useRef, useState } from 'react' import { FileType } from '../types' @@ -70,13 +71,19 @@ export const FileLabel = (props: FileLabelProps) => { onKeyDown={handleEditInput} onBlur={handleEditBlur} > - - {file.name} - + + {file.name} + + ) }