Skip to content

Commit f0d6b7c

Browse files
fix(EntityStatus): fix buttons bg in selected table rows (#2835)
1 parent dd3933f commit f0d6b7c

File tree

7 files changed

+46
-162
lines changed

7 files changed

+46
-162
lines changed

src/components/DeveloperUILinkButton/DeveloperUILinkButton.scss

Lines changed: 0 additions & 5 deletions
This file was deleted.

src/components/DeveloperUILinkButton/DeveloperUILinkButton.tsx

Lines changed: 0 additions & 45 deletions
This file was deleted.

src/components/DeveloperUILinkButton/i18n/en.json

Lines changed: 0 additions & 3 deletions
This file was deleted.

src/components/DeveloperUILinkButton/i18n/index.ts

Lines changed: 0 additions & 7 deletions
This file was deleted.
Lines changed: 34 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
@use '../../styles/mixins.scss';
22

33
.entity-status {
4-
--button-width: 28px;
4+
--button-width: 24px;
5+
--entity-status-height: 20px;
6+
57
position: relative;
68

79
display: inline-flex;
810
align-items: center;
911

1012
max-width: 100%;
11-
height: 100%;
13+
height: var(--entity-status-height);
1214

1315
@include mixins.body-2-typography();
1416

@@ -18,16 +20,27 @@
1820

1921
&__info-icon,
2022
&__clipboard-button {
21-
color: var(--g-color-text-secondary);
23+
// Default button height is 20px. When focused it has 24px height because of outline
24+
// Negative offset is needed to prevent button to have bigger size when focused
25+
--g-button-focus-outline-offset: -2px;
26+
--g-button-focus-outline-width: 2px;
2227

23-
@include mixins.table-hover-appearing-button();
28+
opacity: 0;
29+
color: var(--g-color-text-secondary);
2430

25-
&_visible {
31+
&_visible,
32+
&:focus-visible,
33+
&:hover,
34+
.entity-status__wrapper:focus-within &,
35+
.data-table__row:hover &,
36+
.ydb-paginated-table__row:hover & {
2637
opacity: 1;
2738
}
28-
}
2939

30-
&__info-icon {
40+
&:focus-visible,
41+
.entity-status__wrapper:focus-within {
42+
background-color: var(--g-color-base-float);
43+
}
3144
&:hover {
3245
color: var(--g-color-text-primary);
3346
}
@@ -38,6 +51,8 @@
3851

3952
overflow: hidden;
4053

54+
height: var(--entity-status-height);
55+
4156
&_with-clipboard-button {
4257
padding-right: var(--button-width);
4358
}
@@ -63,34 +78,33 @@
6378
gap: var(--g-spacing-1);
6479

6580
width: 0;
66-
height: 100%;
6781

68-
&_visible {
82+
&_visible,
83+
&:focus-within {
6984
width: min-content;
70-
padding: var(--g-spacing-1);
7185

7286
background-color: var(--g-color-base-background);
7387
}
7488

7589
.data-table__row:hover &,
76-
.ydb-paginated-table__row:hover &,
77-
.ydb-tree-view__item & {
90+
.ydb-paginated-table__row:hover & {
7891
width: min-content;
79-
padding: var(--g-spacing-1);
8092

8193
background-color: var(--ydb-data-table-color-hover);
8294
}
8395
}
8496

85-
&__label {
86-
margin-right: 2px;
87-
88-
color: var(--g-color-text-complementary);
97+
&__wrapper_with-clipboard-button &__link {
98+
width: calc(100% + var(--button-width));
99+
}
89100

90-
@include mixins.body-2-typography();
101+
&__wrapper_with-info-button &__link {
102+
width: calc(100% + var(--button-width));
103+
}
91104

92-
&_size_l {
93-
font-size: var(--g-text-header-2-font-size);
105+
&__wrapper_with-clipboard-button {
106+
&.entity-status__wrapper_with-info-button .entity-status__link {
107+
width: calc(100% + 2 * var(--button-width));
94108
}
95109
}
96110

@@ -99,26 +113,11 @@
99113
overflow: hidden;
100114

101115
width: 100%;
102-
margin-top: 5px;
103116

104117
white-space: nowrap;
105118
text-overflow: ellipsis;
106119
}
107120

108-
&__wrapper_with-clipboard-button &__link {
109-
width: calc(100% + var(--button-width));
110-
}
111-
112-
&__wrapper_with-info-button &__link {
113-
width: calc(100% + var(--button-width));
114-
}
115-
116-
&__wrapper_with-clipboard-button {
117-
&.entity-status__wrapper_with-info-button .entity-status__link {
118-
width: calc(100% + 2 * var(--button-width));
119-
}
120-
}
121-
122121
&__link_with-left-trim {
123122
text-align: end;
124123
direction: rtl;
@@ -127,19 +126,4 @@
127126
unicode-bidi: plaintext;
128127
}
129128
}
130-
131-
&__label {
132-
&_state_blue {
133-
color: var(--ydb-color-status-blue);
134-
}
135-
&_state_yellow {
136-
color: var(--ydb-color-status-yellow);
137-
}
138-
&_state_orange {
139-
color: var(--ydb-color-status-orange);
140-
}
141-
&_state_red {
142-
color: var(--ydb-color-status-red);
143-
}
144-
}
145129
}

src/components/EntityStatus/EntityStatus.tsx

Lines changed: 12 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,7 @@ interface EntityStatusProps {
1818
status?: EFlag;
1919
name?: string;
2020
renderName?: (name?: string) => React.ReactNode;
21-
label?: string;
2221
path?: string;
23-
iconPath?: string;
2422

2523
size?: StatusIconSize;
2624
mode?: StatusIconMode;
@@ -45,9 +43,7 @@ export function EntityStatus({
4543
status = EFlag.Grey,
4644
name = '',
4745
renderName = defaultRenderName,
48-
label,
4946
path,
50-
iconPath,
5147

5248
size = 's',
5349
mode = 'color',
@@ -71,13 +67,7 @@ export function EntityStatus({
7167

7268
return <StatusIcon className={b('icon')} status={status} size={size} mode={mode} />;
7369
};
74-
const renderStatusLink = (href: string) => {
75-
return (
76-
<UIKitLink target="_blank" href={href}>
77-
{renderIcon()}
78-
</UIKitLink>
79-
);
80-
};
70+
8171
const renderLink = () => {
8272
if (path) {
8373
if (externalLink) {
@@ -96,14 +86,10 @@ export function EntityStatus({
9686
}
9787
return name && <span className={b('name')}>{renderName(name)}</span>;
9888
};
89+
9990
return (
10091
<div className={b(null, className)}>
101-
{iconPath ? renderStatusLink(iconPath) : renderIcon()}
102-
{label && (
103-
<span title={label} className={b('label', {size, state: status.toLowerCase()})}>
104-
{label}
105-
</span>
106-
)}
92+
{renderIcon()}
10793
{(path || name) && (
10894
<div
10995
className={b('wrapper', {
@@ -127,15 +113,15 @@ export function EntityStatus({
127113
placement={['top-start', 'bottom-start']}
128114
onOpenChange={(visible) => setInfoIconHovered(visible)}
129115
>
130-
<Button view="normal" size="xs">
131-
<Icon
132-
data={CircleInfo}
133-
size="12"
134-
className={b('info-icon', {
135-
visible:
136-
clipboardButtonAlwaysVisible || infoIconHovered,
137-
})}
138-
/>
116+
<Button
117+
view="normal"
118+
size="xs"
119+
className={b('info-icon', {
120+
visible:
121+
clipboardButtonAlwaysVisible || infoIconHovered,
122+
})}
123+
>
124+
<Icon data={CircleInfo} size="12" />
139125
</Button>
140126
</Popover>
141127
)}

src/styles/mixins.scss

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -284,29 +284,3 @@
284284
--entity-state-border-color: var(--g-color-line-generic-hover);
285285
}
286286
}
287-
288-
@mixin table-hover-appearing-button {
289-
opacity: 0;
290-
291-
&_visible,
292-
&:focus-visible {
293-
opacity: 1;
294-
}
295-
&:focus-visible {
296-
position: absolute;
297-
top: 2px;
298-
right: 2px;
299-
300-
background-color: var(--g-color-base-float);
301-
}
302-
.data-table__row:hover &,
303-
.ydb-paginated-table__row:hover & {
304-
opacity: 1;
305-
}
306-
.data-table__row:hover &:focus-visible,
307-
.ydb-paginated-table__row:hover &:focus-visible {
308-
position: static;
309-
310-
background-color: unset;
311-
}
312-
}

0 commit comments

Comments
 (0)