Skip to content

Commit

Permalink
Unify logic into LightTooltip
Browse files Browse the repository at this point in the history
  • Loading branch information
guergana committed Sep 2, 2024
1 parent e583562 commit dd5318d
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 25 deletions.
17 changes: 0 additions & 17 deletions client/components/Parts/Tooltips/FileMenu.tsx

This file was deleted.

18 changes: 13 additions & 5 deletions client/components/Parts/Tooltips/Light.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,21 @@
import { styled } from '@mui/material/styles'
import Tooltip, { TooltipProps, tooltipClasses } from '@mui/material/Tooltip'

export default styled(({ className, ...props }: TooltipProps) => (
<Tooltip {...props} classes={{ popper: className }} TransitionProps={{ timeout: 0 }} />
))(({ theme }) => ({
interface AllTooltipProps extends TooltipProps {
type?: string
}

export default styled(({ className, ...props }: AllTooltipProps) => (
<Tooltip arrow {...props} classes={{ popper: className }} TransitionProps={{ timeout: 0 }} placement="bottom" />
))(({ theme, type }) => ({
[`& .${tooltipClasses.tooltip}`]: {
backgroundColor: theme.palette.common.white,
color: 'rgba(0, 0, 0, 0.87)',
backgroundColor: type == 'fileMenu' ? theme.palette.OKFNCoolGray.main : theme.palette.common.white,
color: type == 'fileMenu' ? theme.palette.common.white : 'rgba(0, 0, 0, 0.87)',
boxShadow: theme.shadows[1],
fontSize: 16,
maxWidth: type == 'fileMenu' ? 600: null
},
[`& .${tooltipClasses.arrow}`]: {
color: theme.palette.OKFNCoolGray.main,
},
}))
6 changes: 3 additions & 3 deletions client/components/Parts/Trees/File.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import * as types from '../../../types'
import { useTheme } from '@mui/material/styles'
import openFolderIcon from '../../../assets/open_folder_icon.svg'
import closedFolderIcon from '../../../assets/closed_folder_icon.svg'
import FileMenuTooltip from '../Tooltips/FileMenu'
import LightTooltip from '../Tooltips/Light'

export interface FileTreeProps {
files: types.IFile[]
Expand Down Expand Up @@ -136,7 +136,7 @@ function TreeItemIcon(props: { nodeId: string; item: types.IFileTreeItem }) {
// const fontWeight = props.item.type === 'package' ? 'bold' : 'normal'

return (
<FileMenuTooltip title={props.item.label}>
<LightTooltip title={props.item.label} type="fileMenu">
<Box
sx={{
py: 1,
Expand All @@ -155,7 +155,7 @@ function TreeItemIcon(props: { nodeId: string; item: types.IFileTreeItem }) {
borderRadius: '50%',}}>{" "}</div>
<span style={{ whiteSpace: 'nowrap', fontWeight }}>{props.item.label}</span>
</Box>
</FileMenuTooltip>
</LightTooltip>
)
}

Expand Down

0 comments on commit dd5318d

Please sign in to comment.