Skip to content

Commit

Permalink
styling: TreeWidget Node display change
Browse files Browse the repository at this point in the history
This commit changes how nodes are displayed to bring the selected node
display in line with VS Code

Signed-Off-By: FernandoAscencio <fernando.ascencio.cama@ericsson.com>
  • Loading branch information
FernandoAscencio committed Apr 27, 2023
1 parent 089aaa3 commit fe08fd6
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 15 deletions.
2 changes: 1 addition & 1 deletion packages/core/src/browser/tree/tree-widget.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1420,7 +1420,7 @@ export class TreeWidget extends ReactWidget implements StatefulWidget {
return this.labelProvider.getLongName(node);
}
protected getDepthPadding(depth: number): number {
return depth * this.props.leftPadding;
return (depth + 1) * this.props.leftPadding;
}
}
export namespace TreeWidget {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -319,9 +319,4 @@ export class FileTreeWidget extends CompressedTreeWidget {
}
return inflated;
}

protected override getDepthPadding(depth: number): number {
// add additional depth so file nodes are rendered with padding in relation to the top level root node.
return super.getDepthPadding(depth + 1);
}
}
4 changes: 4 additions & 0 deletions packages/scm/src/browser/scm-tree-widget.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,10 @@ export class ScmTreeWidget extends TreeWidget {
return super.getPaddingLeft(node, props);
}

protected override getDepthPadding(depth: number): number {
return super.getDepthPadding(depth) + 5;
}

protected override needsExpansionTogglePadding(node: TreeNode): boolean {
const theme = this.iconThemeService.getDefinition(this.iconThemeService.current);
if (theme && (theme.hidesExplorerArrows || (theme.hasFileIcons && !theme.hasFolderIcons))) {
Expand Down
6 changes: 1 addition & 5 deletions packages/scm/src/browser/style/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,14 @@
font-size: var(--theia-ui-font-size1);
max-height: calc(100% - var(--theia-border-width));
position: relative;
padding: 5px 5px 0px 19px;
}

.theia-scm {
padding: 5px;
box-sizing: border-box;
height: 100%;
}

.theia-side-panel .theia-scm {
padding-left: 19px;
}

.groups-outer-container:focus {
outline: 0;
box-shadow: none;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -718,6 +718,10 @@ export class SearchInWorkspaceResultTreeWidget extends TreeWidget {
};
}

protected override getDepthPadding(depth: number): number {
return super.getDepthPadding(depth) + 5;
}

protected override renderCaption(node: TreeNode, props: NodeProps): React.ReactNode {
if (SearchInWorkspaceRootFolderNode.is(node)) {
return this.renderRootFolderNode(node);
Expand Down
6 changes: 2 additions & 4 deletions packages/search-in-workspace/src/browser/styles/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
}

.t-siw-search-container {
padding: 5px ;
padding: 0px 1px ;
display: flex;
flex-direction: column;
height: 100%;
Expand Down Expand Up @@ -52,8 +52,7 @@
}

.t-siw-search-container .searchHeader {
width: 100%;
margin-bottom: 10px;
padding: 5px 5px 15px 2px;
}

.t-siw-search-container .searchHeader .controls.button-container {
Expand Down Expand Up @@ -195,7 +194,6 @@

.t-siw-search-container .resultContainer {
height: 100%;
margin-left: 13px;
}

.t-siw-search-container .result {
Expand Down

0 comments on commit fe08fd6

Please sign in to comment.