Skip to content

Commit

Permalink
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import React from 'react'
import type { IcnColor } from '../../../../uuiui'
import { FlexRow, Icn, Tooltip, UtopiaStyles, useColorTheme } from '../../../../uuiui'
import { when } from '../../../../utils/react-conditionals'

Expand All @@ -9,7 +8,7 @@ export interface HoverHandlers {
}

export type CartoucheUIProps = React.PropsWithChildren<{
tooltip: string
tooltip?: string | null
source: 'internal' | 'external' | 'literal'
role: 'selection' | 'information' | 'folder'
datatype: 'renderable' | 'boolean' | 'array' | 'object'
Expand Down Expand Up @@ -94,7 +93,7 @@ export const CartoucheUI = React.forwardRef(
}}
ref={ref}
>
<Tooltip title={tooltip}>
<Tooltip title={tooltip ?? ''} disabled={tooltip == null}>
<FlexRow
style={{
cursor: 'pointer',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ interface DataReferenceCartoucheControlProps {
selected: boolean
renderedAt: RenderedAt
surroundingScope: ElementPath
hideTooltip?: boolean
}

export const DataReferenceCartoucheControl = React.memo(
Expand Down Expand Up @@ -131,6 +132,7 @@ export const DataReferenceCartoucheControl = React.memo(
onDelete={NO_OP}
testId={`data-reference-cartouche-${EP.toString(elementPath)}`}
contentIsComingFromServer={isDataComingFromHookResult}
hideTooltip={props.hideTooltip}
/>
{/* this div prevents the popup form putting padding into the condensed rows */}
<div style={{ width: 0 }}>
Expand All @@ -151,6 +153,7 @@ interface DataCartoucheInnerProps {
onDelete: () => void
testId: string
contentIsComingFromServer: boolean
hideTooltip?: boolean
}

export const DataCartoucheInner = React.forwardRef(
Expand Down Expand Up @@ -193,7 +196,7 @@ export const DataCartoucheInner = React.forwardRef(
selected={selected}
inverted={inverted}
testId={testId}
tooltip={contentsToDisplay.label ?? 'DATA'}
tooltip={!props.hideTooltip ? contentsToDisplay.label ?? 'DATA' : null}
role='selection'
source={source}
ref={ref}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ const CondensedEntryItemContent = React.memo(
isDataReference,
<WrappedLayoutIcon
entry={props.entry}
disabled={isDataReference || showLabel}
hideTooltip={isDataReference || showLabel}
selected={props.selected}
/>,
)}
Expand All @@ -341,8 +341,9 @@ const CondensedEntryItemContent = React.memo(
{when(
isDataReference,
<DataReferenceCartoucheControl
selected={props.selected}
{...(props.entry as DataReferenceNavigatorEntry)}
selected={props.selected}
hideTooltip={true}
/>,
)}
</div>
Expand Down Expand Up @@ -436,7 +437,7 @@ const WrappedExpandableIndicator = React.memo(
WrappedExpandableIndicator.displayName = 'WrappedExpandableIndicator'

const WrappedLayoutIcon = React.memo(
(props: { entry: NavigatorEntry; disabled: boolean; selected: boolean }) => {
(props: { entry: NavigatorEntry; hideTooltip: boolean; selected: boolean }) => {
const entryLabel = useEntryLabel(props.entry)

const iconOverride = useEditorState(
Expand All @@ -457,7 +458,7 @@ const WrappedLayoutIcon = React.memo(
)

return (
<Tooltip title={entryLabel} disabled={props.disabled}>
<Tooltip title={entryLabel} disabled={props.hideTooltip}>
<div
style={{
width: '100%',
Expand Down

0 comments on commit 5f39016

Please sign in to comment.