From f43f09ab006a50ca29b3e3d19567d8538390708f Mon Sep 17 00:00:00 2001 From: Joseph Izang Date: Thu, 11 Jan 2024 13:50:57 +0100 Subject: [PATCH] add icon hover component --- .../components/file-explorer-hovericons.tsx | 100 ++++++++++++++++++ 1 file changed, 100 insertions(+) create mode 100644 libs/remix-ui/workspace/src/lib/components/file-explorer-hovericons.tsx diff --git a/libs/remix-ui/workspace/src/lib/components/file-explorer-hovericons.tsx b/libs/remix-ui/workspace/src/lib/components/file-explorer-hovericons.tsx new file mode 100644 index 0000000000..61485287b4 --- /dev/null +++ b/libs/remix-ui/workspace/src/lib/components/file-explorer-hovericons.tsx @@ -0,0 +1,100 @@ +import React, { useState } from 'react' +import { CustomTooltip } from '@remix-ui/helper' +import { FormattedMessage } from 'react-intl' +import { ROOT_PATH } from '../utils/constants' + +export type FileHoverIconsProps = { + hover: boolean + isEditable: boolean + file: any + handleNewFolderOp: any + handleNewFileOp: any + renamePathOp: any + deletePathOp: any +} + +export function FileHoverIcons(props: FileHoverIconsProps) { + + return ( + <> + {(props.hover && !props.isEditable) &&
+ { + props.file.isDirectory ? ( + <> + } + tooltipId={`filePanel.edit.${props.file.path}`} + tooltipClasses="text-nowrap" + > + { + e.stopPropagation() + console.log(props) + await props.handleNewFolderOp(props.file.path) + console.log('clicked on folder icon') + }} + > + + } + tooltipId={`fileExplorer.edit.${props.file.path}`} + tooltipClasses="text-nowrap" + > + { + e.stopPropagation() + await props.handleNewFileOp(props.file.path) + console.log('clicked on file icon') + }} + > + + + ) : null + } + } + tooltipId={`fileExplorer.edit.${props.file.path}`} + tooltipClasses="text-nowrap" + > + { + e.stopPropagation() + console.log(props) + console.log(e) + await props.renamePathOp(props.file.path, props.file.type) + console.log('clicked on edit icon') + }} + > + + } + tooltipId={`fileExplorer.edit.${props.file.path}`} + tooltipClasses="text-nowrap" + > + { + e.stopPropagation() + console.log(props) + console.log(e) + console.log('clicked on trash icon') + await props.deletePathOp(props.file.path) + }} + > + +
+ } + + ) +}