Skip to content

Commit 830c0a5

Browse files
authored
feat: improve appearing controls styles (#1436)
1 parent 6cc07d5 commit 830c0a5

File tree

18 files changed

+126
-114
lines changed

18 files changed

+126
-114
lines changed

src/components/ClipboardButton/ClipboardButton.tsx

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

src/components/ClipboardButton/index.ts

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,5 @@
1-
.developer-ui-link-button {
2-
display: none;
3-
4-
&_visible {
5-
display: inline-block;
6-
}
1+
@import '../../styles/mixins.scss';
72

8-
.data-table__row:hover &,
9-
.ydb-paginated-table__row:hover & {
10-
display: inline-block;
11-
}
3+
.developer-ui-link-button {
4+
@include table-hover-appearing-button();
125
}
Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,45 @@
11
import {ArrowUpRightFromSquare} from '@gravity-ui/icons';
2+
import type {ButtonSize} from '@gravity-ui/uikit';
23
import {Button, Icon} from '@gravity-ui/uikit';
34

45
import {cn} from '../../utils/cn';
56

7+
import i18n from './i18n';
8+
69
import './DeveloperUILinkButton.scss';
710

811
const b = cn('developer-ui-link-button');
912

13+
const buttonSizeToIconSize: Record<ButtonSize, number> = {
14+
xs: 14,
15+
s: 16,
16+
m: 16,
17+
l: 18,
18+
xl: 18,
19+
};
20+
1021
interface DeveloperUiLinkProps {
1122
className?: string;
1223
visible?: boolean;
1324
href: string;
25+
size?: ButtonSize;
1426
}
1527

16-
export function DeveloperUILinkButton({href, visible = false, className}: DeveloperUiLinkProps) {
28+
export function DeveloperUILinkButton({
29+
href,
30+
visible = false,
31+
className,
32+
size = 's',
33+
}: DeveloperUiLinkProps) {
1734
return (
18-
<Button size="s" href={href} className={b({visible}, className)} target="_blank">
19-
<Icon data={ArrowUpRightFromSquare} />
35+
<Button
36+
size={size}
37+
href={href}
38+
className={b({visible}, className)}
39+
target="_blank"
40+
title={i18n('action_go-to', {href})}
41+
>
42+
<Icon data={ArrowUpRightFromSquare} size={buttonSizeToIconSize[size]} />
2043
</Button>
2144
);
2245
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"action_go-to": "Go to {{href}}"
3+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import {registerKeysets} from '../../../utils/i18n';
2+
3+
import en from './en.json';
4+
5+
const COMPONENT = 'ydb-developer-ui-button';
6+
7+
export default registerKeysets(COMPONENT, {en});

src/components/EntityStatus/EntityStatus.scss

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
@import '../../styles/mixins.scss';
22

33
.entity-status {
4+
position: relative;
5+
46
display: inline-flex;
57
align-items: center;
68

@@ -14,24 +16,33 @@
1416
}
1517

1618
&__clipboard-button {
19+
color: var(--g-color-text-secondary);
20+
21+
@include table-hover-appearing-button();
22+
}
23+
24+
&__controls-wrapper {
25+
position: absolute;
26+
top: 0;
27+
right: 0;
28+
1729
display: flex;
18-
flex-shrink: 0;
30+
align-items: center;
31+
gap: var(--g-spacing-1);
1932

20-
margin-left: var(--g-spacing-2);
33+
width: 0;
34+
height: 100%;
2135

22-
opacity: 0;
23-
color: var(--g-color-text-secondary);
36+
background-color: var(--g-color-base-float);
2437

25-
&_visible,
26-
&:focus-visible {
27-
opacity: 1;
38+
.data-table__row:hover &,
39+
.ydb-paginated-table__row:hover &,
40+
.ydb-tree-view__item & {
41+
width: min-content;
42+
padding: var(--g-spacing-1);
2843
}
2944
}
3045

31-
&__additional-controls {
32-
margin-left: var(--g-spacing-1);
33-
}
34-
3546
&__label {
3647
margin-right: 2px;
3748

src/components/EntityStatus/EntityStatus.tsx

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
import {Link as UIKitLink} from '@gravity-ui/uikit';
1+
import {ClipboardButton, Link as UIKitLink} from '@gravity-ui/uikit';
22

33
import {EFlag} from '../../types/api/enums';
44
import {cn} from '../../utils/cn';
5-
import {ClipboardButton} from '../ClipboardButton';
65
import {InternalLink} from '../InternalLink/InternalLink';
76
import {StatusIcon} from '../StatusIcon/StatusIcon';
87
import type {StatusIconMode, StatusIconSize} from '../StatusIcon/StatusIcon';
@@ -95,18 +94,21 @@ export function EntityStatus({
9594
</span>
9695
)}
9796
<span className={b('link', {'with-left-trim': withLeftTrim})}>{renderLink()}</span>
98-
{hasClipboardButton && (
99-
<ClipboardButton
100-
text={name}
101-
size="s"
102-
className={b('clipboard-button', {
103-
visible: clipboardButtonAlwaysVisible,
104-
})}
105-
/>
106-
)}
107-
{additionalControls && (
108-
<span className={b('additional-controls ')}>{additionalControls}</span>
109-
)}
97+
<div className={b('controls-wrapper')}>
98+
{hasClipboardButton && (
99+
<ClipboardButton
100+
text={name}
101+
size="xs"
102+
view="normal"
103+
className={b('clipboard-button', {
104+
visible: clipboardButtonAlwaysVisible,
105+
})}
106+
/>
107+
)}
108+
{additionalControls && (
109+
<span className={b('additional-controls')}>{additionalControls}</span>
110+
)}
111+
</div>
110112
</div>
111113
);
112114
}

src/components/NodeHostWrapper/NodeHostWrapper.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,9 @@ export const NodeHostWrapper = ({node, getNodeRef, database}: NodeHostWrapperPro
4242
})
4343
: undefined;
4444

45-
const additionalControls = nodeHref ? <DeveloperUILinkButton href={nodeHref} /> : null;
45+
const additionalControls = nodeHref ? (
46+
<DeveloperUILinkButton href={nodeHref} size="xs" />
47+
) : null;
4648

4749
return (
4850
<CellWithPopover

src/components/PaginatedTable/PaginatedTable.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
--paginated-table-cell-horizontal-padding: 10px;
88

99
--paginated-table-border-color: var(--g-color-base-generic-hover);
10-
--paginated-table-hover-color: var(--g-color-base-float-hover);
10+
--paginated-table-hover-color: var(--g-color-base-float);
1111

1212
width: 100%;
1313
@include body-2-typography();

0 commit comments

Comments
 (0)