@@ -5,31 +5,34 @@ import { useTheme } from '@emotion/react';
55import Icon from '@leafygreen-ui/icon' ;
66import { useState } from 'react' ;
77
8- import { ellipsisTruncation } from '@/styles/styles' ;
9- import {
10- DEFAULT_FIELD_HEIGHT ,
11- DEFAULT_FIELD_PADDING ,
12- DEFAULT_NODE_HEADER_HEIGHT ,
13- ZOOM_THRESHOLD ,
14- } from '@/utilities/constants' ;
8+ import { DEFAULT_NODE_HEADER_HEIGHT , ZOOM_THRESHOLD } from '@/utilities/constants' ;
159import { InternalNode } from '@/types/internal' ;
1610import { NodeBorder } from '@/components/node/node-border' ;
1711import { FieldList } from '@/components/field/field-list' ;
1812import { NodeType } from '@/types' ;
1913
20- const NodeZoomedOut = styled . div < { height : number } > `
14+ const NodeZoomedOut = styled . div `
2115 display: flex;
2216 align-items: center;
2317 justify-content: center;
24- height: ${ props => props . height } px;
18+ position: absolute;
19+ width: 100%;
20+ height: 100%;
2521` ;
2622
2723const NodeZoomedOutInner = styled . div `
2824 font-size: 20px;
2925 text-align: center;
26+ min-width: 0;
3027 padding-left: ${ spacing [ 300 ] } px;
3128 padding-right: ${ spacing [ 300 ] } px;
32- ${ ellipsisTruncation }
29+ display: -webkit-box;
30+ -webkit-line-clamp: 3;
31+ -webkit-box-orient: vertical;
32+ overflow: hidden;
33+ text-overflow: ellipsis;
34+ word-break: break-word;
35+ overflow-wrap: break-word;
3336` ;
3437
3538const NodeWrapper = styled . div < { accent : string ; color : string ; background : string } > `
@@ -90,6 +93,10 @@ const NodeHandle = styled(Handle)<{ ['z-index']?: number }>`
9093 z-index: ${ props => props [ 'z-index' ] } ;
9194` ;
9295
96+ const NodeWithFields = styled . div < { visibility : string } > `
97+ visibility: ${ props => props . visibility } ;
98+ ` ;
99+
93100export const Node = ( {
94101 type,
95102 selected,
@@ -164,22 +171,20 @@ export const Node = ({
164171 z-index = { fromHandle ? 1 : 0 }
165172 />
166173 < NodeWrapper accent = { getAccent ( ) } color = { getNodeColor ( ) } background = { getNodeBackground ( ) } >
167- < NodeHeader background = { getHeaderBackground ( ) } >
168- { ! isContextualZoom && (
169- < >
170- < NodeHeaderIcon >
171- < Icon fill = { theme . node . headerIcon } glyph = "Drag" />
172- </ NodeHeaderIcon >
173- < NodeHeaderTitle > { title } </ NodeHeaderTitle >
174- </ >
175- ) }
176- </ NodeHeader >
177174 { isContextualZoom && (
178- < NodeZoomedOut height = { fields . length * DEFAULT_FIELD_HEIGHT + DEFAULT_FIELD_PADDING * 2 } >
175+ < NodeZoomedOut >
179176 < NodeZoomedOutInner title = { title } > { title } </ NodeZoomedOutInner >
180177 </ NodeZoomedOut >
181178 ) }
182- { ! isContextualZoom && < FieldList nodeType = { type as NodeType } isHovering = { isHovering } fields = { fields } /> }
179+ < NodeWithFields visibility = { isContextualZoom ? 'hidden' : 'none' } >
180+ < NodeHeader background = { getHeaderBackground ( ) } >
181+ < NodeHeaderIcon >
182+ < Icon fill = { theme . node . headerIcon } glyph = "Drag" />
183+ </ NodeHeaderIcon >
184+ < NodeHeaderTitle > { title } </ NodeHeaderTitle >
185+ </ NodeHeader >
186+ < FieldList nodeType = { type as NodeType } isHovering = { isHovering } fields = { fields } />
187+ </ NodeWithFields >
183188 </ NodeWrapper >
184189 </ NodeBorder >
185190 </ div >
0 commit comments