Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UI: Fix tree node icon alignment #2853

Merged
merged 8 commits into from
Jan 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@itwin/core-react",
"comment": "",
"type": "none"
}
],
"packageName": "@itwin/core-react"
}
21 changes: 14 additions & 7 deletions ui/core-react/src/core-react/tree/Node.scss
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ $node-font-size: $iui-font-size;
align-items: center;
width: 100%;

> .loader {
margin: auto 4px;
> .iui-progress-indicator-radial {
margin: 0 4px;
}

> .expansion-toggle {
Expand All @@ -50,15 +50,22 @@ $node-font-size: $iui-font-size;
line-height: unset;
}
}

> .core-image-checkbox {
top: -1px;
}
}

&-icon {
width: 16px;
height: 24px;
display: inline-block;
box-sizing: border-box;
padding: 5px 0;
margin-right: 5px;
margin: 0 5px;

> .bui-webfont-icon {
display: inline-block;
width: 16px;
text-align: center;
vertical-align: middle;
}
}

&.is-focused, &:focus {
Expand Down
4 changes: 1 addition & 3 deletions ui/core-react/src/core-react/tree/Node.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,6 @@ export class TreeNode extends React.Component<TreeNodeProps> {
if (!this.props.isLoading && this.props.isLeaf)
offset += EXPANSION_TOGGLE_WIDTH; // Add expansion toggle/loader width if they're not rendered

const loader = this.props.isLoading ? (<div className="loader"><ProgressRadial size="x-small" indeterminate /></div>) : undefined;

let checkbox: React.ReactNode;
if (this.props.checkboxProps) {
const props: NodeCheckboxRenderProps = {
Expand Down Expand Up @@ -154,7 +152,7 @@ export class TreeNode extends React.Component<TreeNodeProps> {
style={{ marginLeft: offset }}
data-testid={this.createSubComponentTestId("contents")}
>
{loader}
{this.props.isLoading && <ProgressRadial size="x-small" indeterminate />}
{toggle}
{checkbox}
{icon}
Expand Down
12 changes: 4 additions & 8 deletions ui/core-react/src/test/tree/Node.test.snap
Original file line number Diff line number Diff line change
Expand Up @@ -164,14 +164,10 @@ exports[`<Node /> renders loader correctly 1`] = `
}
}
>
<div
className="loader"
>
<ProgressRadial
indeterminate={true}
size="x-small"
/>
</div>
<ProgressRadial
indeterminate={true}
size="x-small"
/>
a
</div>
</div>
Expand Down