Skip to content
This repository was archived by the owner on Jul 30, 2025. It is now read-only.

Commit 7a32591

Browse files
committed
fix: improve handling of narrower windows
1) hide CurrentGitBranch in narrower windows 2) don't show the status text (only status badge) in narrower windows Fixes #4181
1 parent a7c72e8 commit 7a32591

File tree

4 files changed

+48
-18
lines changed

4 files changed

+48
-18
lines changed

plugins/plugin-client-common/src/components/StatusStripe/TextWithIconWidget.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ interface Props {
2424
text: string
2525
viewLevel: ViewLevel
2626

27+
className?: string
2728
iconIsNarrow?: boolean
2829
iconOnclick?: string
2930
textOnclick?: string
@@ -64,7 +65,11 @@ export default class TextWithIconWidget extends React.PureComponent<Props> {
6465

6566
return (
6667
<div
67-
className={'kui--status-stripe-element' + (!this.props.id ? '' : ' ' + this.props.id)}
68+
className={
69+
'kui--status-stripe-element' +
70+
(!this.props.id ? '' : ' ' + this.props.id) +
71+
(this.props.className ? ' ' + this.props.className : '')
72+
}
6873
data-view={this.props.viewLevel}
6974
>
7075
{iconPart}

plugins/plugin-client-common/web/scss/components/Table/badges.scss

Lines changed: 34 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -59,28 +59,48 @@
5959
}
6060
}
6161

62-
.repl.sidecar-visible .bx--data-table-container .bx--data-table {
63-
th[data-key='STATUS'],
64-
td.kui--status-cell {
65-
padding-left: 0;
62+
@mixin narrow-window {
63+
@media (max-width: 44rem) {
64+
@content;
6665
}
67-
[data-tag='badge'] {
68-
justify-content: center;
66+
}
6967

70-
[data-tag='badge-circle'] {
71-
margin: 0;
72-
width: 1em;
73-
height: 1em;
74-
border-radius: 0;
68+
@mixin badge-only {
69+
.bx--data-table-container .bx--data-table {
70+
th[data-key='STATUS'],
71+
td.kui--status-cell {
72+
padding-left: 0;
7573
}
74+
[data-tag='badge'] {
75+
justify-content: center;
76+
77+
[data-tag='badge-circle'] {
78+
margin: 0;
79+
width: 1em;
80+
height: 1em;
81+
border-radius: 0;
82+
}
7683

77-
.kui--cell-inner-text {
78-
/* show only the badge-circle when the sidecar is open */
79-
display: none;
84+
.kui--cell-inner-text {
85+
/* show only the badge-circle when the sidecar is open */
86+
display: none;
87+
}
8088
}
8189
}
8290
}
8391

92+
/* fine-tune the STATUS/badge presentation of tables when the sidecar is open, or with narrower windows */
93+
.repl.sidecar-visible {
94+
@include badge-only;
95+
}
96+
@include narrow-window {
97+
@include badge-only;
98+
99+
.kui--hide-in-narrower-windows {
100+
display: none !important;
101+
}
102+
}
103+
84104
[data-table-watching='true'] .bx--data-table {
85105
[data-tag='badge-circle'].yellow-background {
86106
animation: var(--animation-repeating-pulse);

plugins/plugin-client-default/src/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export default function renderMain(props: KuiProps) {
3333
return (
3434
<Kui isPopup={props.isPopup} commandLine={props.commandLine}>
3535
<ContextWidgets>
36-
<CurrentGitBranch />
36+
<CurrentGitBranch className="kui--hide-in-narrower-windows" />
3737
<CurrentContext />
3838
<CurrentNamespace />
3939
</ContextWidgets>

plugins/plugin-git/src/CurrentGitBranch.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,17 @@ import { ViewLevel, TextWithIconWidget } from '@kui-shell/plugin-client-common'
2222

2323
const strings = i18n('plugin-bash-like')
2424

25+
interface Props {
26+
className?: string
27+
}
28+
2529
interface State {
2630
text: string
2731
viewLevel: ViewLevel
2832
}
2933

30-
export default class CurrentGitBranch extends React.PureComponent<{}, State> {
31-
public constructor(props = {}) {
34+
export default class CurrentGitBranch extends React.PureComponent<Props, State> {
35+
public constructor(props: Props) {
3236
super(props)
3337

3438
this.state = {
@@ -91,6 +95,7 @@ export default class CurrentGitBranch extends React.PureComponent<{}, State> {
9195
public render() {
9296
return (
9397
<TextWithIconWidget
98+
className={this.props.className}
9499
text={this.state.text}
95100
viewLevel={this.state.viewLevel}
96101
id="kui--plugin-git--current-git-branch"

0 commit comments

Comments
 (0)