@@ -5,31 +5,34 @@ import { useTheme } from '@emotion/react';
5
5
import Icon from '@leafygreen-ui/icon' ;
6
6
import { useState } from 'react' ;
7
7
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' ;
15
9
import { InternalNode } from '@/types/internal' ;
16
10
import { NodeBorder } from '@/components/node/node-border' ;
17
11
import { FieldList } from '@/components/field/field-list' ;
18
12
import { NodeType } from '@/types' ;
19
13
20
- const NodeZoomedOut = styled . div < { height : number } > `
14
+ const NodeZoomedOut = styled . div `
21
15
display: flex;
22
16
align-items: center;
23
17
justify-content: center;
24
- height: ${ props => props . height } px;
18
+ position: absolute;
19
+ width: 100%;
20
+ height: 100%;
25
21
` ;
26
22
27
23
const NodeZoomedOutInner = styled . div `
28
24
font-size: 20px;
29
25
text-align: center;
26
+ min-width: 0;
30
27
padding-left: ${ spacing [ 300 ] } px;
31
28
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;
33
36
` ;
34
37
35
38
const NodeWrapper = styled . div < { accent : string ; color : string ; background : string } > `
@@ -90,6 +93,10 @@ const NodeHandle = styled(Handle)<{ ['z-index']?: number }>`
90
93
z-index: ${ props => props [ 'z-index' ] } ;
91
94
` ;
92
95
96
+ const NodeWithFields = styled . div < { visibility : string } > `
97
+ visibility: ${ props => props . visibility } ;
98
+ ` ;
99
+
93
100
export const Node = ( {
94
101
type,
95
102
selected,
@@ -164,22 +171,20 @@ export const Node = ({
164
171
z-index = { fromHandle ? 1 : 0 }
165
172
/>
166
173
< 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 >
177
174
{ isContextualZoom && (
178
- < NodeZoomedOut height = { fields . length * DEFAULT_FIELD_HEIGHT + DEFAULT_FIELD_PADDING * 2 } >
175
+ < NodeZoomedOut >
179
176
< NodeZoomedOutInner title = { title } > { title } </ NodeZoomedOutInner >
180
177
</ NodeZoomedOut >
181
178
) }
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 >
183
188
</ NodeWrapper >
184
189
</ NodeBorder >
185
190
</ div >
0 commit comments