Skip to content

Commit dadb681

Browse files
authored
feat: less visual weight (#4075)
1 parent 008f1ee commit dadb681

File tree

4 files changed

+111
-5
lines changed

4 files changed

+111
-5
lines changed

src/flows/components/panel/FlowPanel.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import {MenuButton} from 'src/flows/components/Sidebar'
2222

2323
// Constants
2424
import {PIPE_DEFINITIONS} from 'src/flows'
25-
import {FeatureFlag} from 'src/shared/utils/featureFlag'
25+
import {FeatureFlag, isFlagEnabled} from 'src/shared/utils/featureFlag'
2626

2727
// Types
2828
import {PipeContextProps} from 'src/types/flows'
@@ -59,6 +59,7 @@ const FlowPanel: FC<Props> = ({
5959
const panelClassName = classnames('flow-panel', {
6060
[`flow-panel__${isVisible ? 'visible' : 'hidden'}`]: true,
6161
'flow-panel__focus': focused === id,
62+
'small-insert': isFlagEnabled('smallInsert'),
6263
})
6364

6465
const [size, updateSize] = useState<number>(

src/flows/components/panel/InsertCellButton.scss

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,41 @@
33

44
$cf-radius-lg: $cf-radius + 4px;
55

6+
.small-flow-divider {
7+
position: relative;
8+
margin-bottom: 4px;
9+
text-align: right;
10+
11+
.insert-wrap {
12+
padding: 8px 0;
13+
display: inline-block;
14+
cursor: pointer;
15+
16+
&:active,
17+
&:hover {
18+
.cf-button.flow-divider--button {
19+
background: linear-gradient(45deg, #5c10a0 0%, #8e1fc3 100%);
20+
color: #fff;
21+
}
22+
span {
23+
color: #fff;
24+
}
25+
}
26+
}
27+
28+
.cf-button.flow-divider--button {
29+
position: static;
30+
transform: none;
31+
margin: -4px 8px 0;
32+
background: inherit;
33+
}
34+
35+
span {
36+
font-size: 12px;
37+
color: #68687b;
38+
}
39+
}
40+
641
.flow-divider {
742
position: relative;
843
width: 100%;

src/flows/components/panel/InsertCellButton.tsx

Lines changed: 61 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ const InsertCellButton: FC<Props> = ({id}) => {
3232
const {flow} = useContext(FlowContext)
3333
const dividerRef = useRef<HTMLDivElement>(null)
3434
const buttonRef = useRef<HTMLButtonElement>(null)
35+
const smallButtonRef = useRef<HTMLDivElement>(null)
3536
const popoverVisible = useRef<boolean>(false)
3637
const index = flow.data.allIDs.indexOf(id)
3738

@@ -52,10 +53,7 @@ const InsertCellButton: FC<Props> = ({id}) => {
5253
dividerRef.current.classList.remove('flow-divider__popped')
5354
}
5455

55-
if (
56-
isFlagEnabled('showLastInsert') &&
57-
index === flow.data.allIDs.length - 1
58-
) {
56+
if (index === flow.data.allIDs.length - 1) {
5957
return (
6058
<FlexBox
6159
direction={FlexDirection.Column}
@@ -69,6 +67,65 @@ const InsertCellButton: FC<Props> = ({id}) => {
6967
)
7068
}
7169

70+
if (isFlagEnabled('smallInsert')) {
71+
let button
72+
if (index === -1) {
73+
button = (
74+
<div className="insert-wrap" ref={smallButtonRef}>
75+
<span>Insert Panel Here</span>
76+
<SquareButton
77+
icon={IconFont.Plus_New}
78+
size={ComponentSize.ExtraSmall}
79+
color={ComponentColor.Secondary}
80+
testID={`panel-add-btn-${index}`}
81+
className="flow-divider--button"
82+
active={popoverVisible.current}
83+
/>
84+
</div>
85+
)
86+
} else {
87+
button = (
88+
<div className="insert-wrap" ref={smallButtonRef}>
89+
<span>Insert Panel Below</span>
90+
<SquareButton
91+
icon={IconFont.ArrowDown_New}
92+
size={ComponentSize.ExtraSmall}
93+
color={ComponentColor.Secondary}
94+
testID={`panel-add-btn-${index}`}
95+
className="flow-divider--button"
96+
active={popoverVisible.current}
97+
/>
98+
</div>
99+
)
100+
}
101+
return (
102+
<div className="small-flow-divider" ref={dividerRef}>
103+
{button}
104+
105+
<Popover
106+
enableDefaultStyles={false}
107+
appearance={Appearance.Outline}
108+
color={ComponentColor.Secondary}
109+
triggerRef={smallButtonRef}
110+
position={PopoverPosition.ToTheRight}
111+
onShow={handlePopoverShow}
112+
onHide={handlePopoverHide}
113+
contents={onHide => (
114+
<FlexBox
115+
direction={FlexDirection.Column}
116+
alignItems={AlignItems.Stretch}
117+
margin={ComponentSize.Small}
118+
className="insert-cell-menu"
119+
>
120+
<p className="insert-cell-menu--title">Insert Panel Here</p>
121+
<AddButtons index={index} onInsert={onHide} />
122+
</FlexBox>
123+
)}
124+
/>
125+
</div>
126+
)
127+
}
128+
72129
return (
73130
<div className="flow-divider" ref={dividerRef}>
74131
<SquareButton

src/flows/style.scss

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,19 @@ $cf-radius-lg: $cf-radius + 4px;
5656
&:first-child::after {
5757
top: ($flow-header-height - $flow-panel--node-dot) * 0.5;
5858
}
59+
60+
&.small-insert {
61+
.flow-panel--node-wrapper {
62+
display: none;
63+
}
64+
.flow-panel--body {
65+
padding-left: inherit;
66+
}
67+
68+
&:after {
69+
display: none;
70+
}
71+
}
5972
}
6073

6174
.flow-panel__readonly {

0 commit comments

Comments
 (0)