Skip to content

Commit d355d28

Browse files
left side nav bar (microsoft#7438)
1 parent db297c4 commit d355d28

File tree

3 files changed

+56
-1
lines changed

3 files changed

+56
-1
lines changed

news/1 Enhancements/7377.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Add left side navigation bar to native editor

src/datascience-ui/native-editor/nativeCell.tsx

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@ export class NativeCell extends React.Component<INativeCellProps, INativeCellSta
153153
return (
154154
<div className={cellWrapperClass} role={this.props.role} ref={this.wrapperRef} tabIndex={0} onKeyDown={this.onOuterKeyDown} onClick={this.onMouseClick} onDoubleClick={this.onMouseDoubleClick}>
155155
<div className={cellOuterClass}>
156+
{this.renderNavbar()}
156157
{this.renderControls()}
157158
<div className='content-div'>
158159
{content}
@@ -473,6 +474,35 @@ export class NativeCell extends React.Component<INativeCellProps, INativeCellSta
473474
}
474475
}
475476

477+
private renderNavbar = () => {
478+
const cellId = this.props.cellVM.cell.id;
479+
480+
const moveUp = () => {
481+
this.moveCellUp();
482+
this.props.stateController.sendCommand(NativeCommandType.MoveCellUp, 'mouse');
483+
};
484+
const moveDown = () => {
485+
this.moveCellDown();
486+
this.props.stateController.sendCommand(NativeCommandType.MoveCellDown, 'mouse');
487+
};
488+
const canMoveUp = this.props.stateController.canMoveUp(cellId);
489+
const canMoveDown = this.props.stateController.canMoveDown(cellId);
490+
491+
return (
492+
<div className='navbar-div'>
493+
<div>
494+
<ImageButton baseTheme={this.props.baseTheme} onClick={moveUp} disabled={!canMoveUp} tooltip={getLocString('DataScience.moveCellUp', 'Move cell up')}>
495+
<Image baseTheme={this.props.baseTheme} class='image-button-image' image={ImageName.Up} />
496+
</ImageButton>
497+
</div>
498+
<div>
499+
<ImageButton baseTheme={this.props.baseTheme} onClick={moveDown} disabled={!canMoveDown} tooltip={getLocString('DataScience.moveCellDown', 'Move cell down')}>
500+
<Image baseTheme={this.props.baseTheme} class='image-button-image' image={ImageName.Down} />
501+
</ImageButton>
502+
</div>
503+
</div>
504+
);
505+
}
476506
private renderMiddleToolbar = () => {
477507
const cellId = this.props.cellVM.cell.id;
478508
const deleteCell = () => {

src/datascience-ui/native-editor/nativeEditor.less

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,14 @@
6161
overflow-x: scroll;
6262
}
6363

64+
.cell-outer {
65+
display:grid;
66+
grid-template-columns:auto auto 1fr;
67+
}
68+
6469
.cell-outer-editable {
70+
display:grid;
71+
grid-template-columns:auto auto 1fr;
6572
margin-top: 0px;
6673
}
6774

@@ -108,15 +115,24 @@
108115
background: var(--override-widget-background, var(--vscode-notifications-background));
109116
}
110117

118+
.content-div {
119+
grid-column: 3;
120+
}
121+
111122
.controls-div {
112-
grid-column: 1;
123+
grid-column: 2;
113124
grid-template-columns: max-content min-content ;
114125
justify-content: end;
115126
display: grid;
116127
min-width: 50px;
117128
grid-template-rows: min-content max-content;
118129
}
119130

131+
.navbar-div {
132+
grid-column: 1;
133+
visibility: hidden;
134+
}
135+
120136
.execution-count {
121137
justify-self: end;
122138
}
@@ -135,6 +151,14 @@
135151
visibility: collapse;
136152
}
137153

154+
.cell-wrapper-selected .navbar-div {
155+
visibility: visible;
156+
}
157+
158+
.cell-wrapper-focused .navbar-div {
159+
visibility: visible;
160+
}
161+
138162
.cell-wrapper-selected .native-editor-celltoolbar-middle {
139163
visibility: visible;
140164
}

0 commit comments

Comments
 (0)