Skip to content

Commit a5f366a

Browse files
committed
fix styles
1 parent fb0ca0d commit a5f366a

9 files changed

Lines changed: 81 additions & 16 deletions

File tree

client_v2/src/common/controls/Select/CustomClearIndicator.tsx

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,33 @@
11
import React from 'react';
2+
import cn from 'clsx';
23
import { ClearIndicatorProps } from 'react-select';
34
import { Icon } from 'panel/common/ui/Icon';
45
import theme from 'panel/lib/theme';
56

6-
export const CustomClearIndicator = <OptionType extends Record<string, any> = any, IsMulti extends boolean = false>(
7+
export const CustomClearIndicator = <
8+
OptionType extends Record<string, any> = any,
9+
IsMulti extends boolean = false,
10+
>(
711
props: ClearIndicatorProps<OptionType, IsMulti>,
812
) => {
9-
const { hasValue, innerProps } = props;
13+
const { hasValue, innerProps, selectProps } = props;
1014

1115
if (!hasValue) {
1216
return null;
1317
}
1418

19+
const noDropdownIndicator = selectProps.isMulti && hasValue;
20+
1521
return (
16-
<div className={theme.select.clearIndicator} {...innerProps}>
22+
<div
23+
role="button"
24+
tabIndex={0}
25+
className={cn(
26+
theme.select.clearIndicator,
27+
noDropdownIndicator && theme.select.clearIndicatorEnd,
28+
)}
29+
{...innerProps}
30+
>
1731
<Icon icon="cross" className={theme.select.clearIcon} />
1832
</div>
1933
);

client_v2/src/components/Clients/AddClient/AddClient.module.pcss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
.navLink {
3030
display: block;
3131
text-decoration: none;
32-
padding: 8px 16px;
32+
padding: 16px;
3333
border-radius: 8px;
3434
width: 100%;
3535
cursor: pointer;
@@ -87,7 +87,7 @@
8787
padding: 16px;
8888
}
8989

90-
.actions button {
90+
.actionButton {
9191
width: auto;
9292
min-width: 200px;
9393
}

client_v2/src/components/Clients/AddClient/AddClient.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,7 @@ export const AddClient = () => {
189189
isMulti
190190
size="responsive"
191191
height="big"
192+
closeMenuOnSelect={false}
192193
/>
193194
</div>
194195

@@ -334,6 +335,7 @@ export const AddClient = () => {
334335
onClick={handleSave}
335336
disabled={form.processingSave}
336337
data-testid="client-form-save"
338+
className={s.actionButton}
337339
>
338340
{intl.getMessage('save_btn')}
339341
</Button>
@@ -342,6 +344,7 @@ export const AddClient = () => {
342344
size="small"
343345
onClick={handleCancel}
344346
data-testid="client-form-cancel"
347+
className={s.actionButton}
345348
>
346349
{intl.getMessage('cancel_btn')}
347350
</Button>

client_v2/src/components/Clients/Clients.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ export const Clients = () => {
8686
className={cn(theme.layout.title, theme.title.h4, theme.title.h3_tablet)}
8787
data-testid="clients-title"
8888
>
89-
{intl.getMessage('client_settings')}
89+
{intl.getMessage('clients')}
9090
</h1>
9191

9292
<button

client_v2/src/components/Clients/blocks/PersistentClientsTable/PersistentClientsTable.module.pcss

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,20 @@
104104
}
105105
}
106106

107+
.copyBtnGreen {
108+
color: var(--default-product-icon);
109+
110+
&:hover {
111+
opacity: 0.8;
112+
}
113+
}
114+
115+
.copyBtnTopRight {
116+
position: absolute;
117+
top: 8px;
118+
right: 8px;
119+
}
120+
107121
.servicesIcons {
108122
display: flex;
109123
align-items: center;
@@ -160,8 +174,6 @@
160174
flex-shrink: 0;
161175
}
162176

163-
/* --- Tags --- */
164-
165177
.tagsRow {
166178
display: flex;
167179
align-items: center;
@@ -183,7 +195,9 @@
183195
}
184196

185197
.tagsTooltip {
198+
position: relative;
186199
padding: 8px 0;
200+
padding-right: 36px;
187201
background: var(--page-background-additional);
188202
border-radius: 8px;
189203
max-height: 240px;
@@ -199,8 +213,6 @@
199213
white-space: nowrap;
200214
}
201215

202-
/* --- Misc --- */
203-
204216
.userIcon {
205217
width: 16px;
206218
height: 16px;
@@ -292,7 +304,9 @@
292304
}
293305

294306
.idsTooltip {
307+
position: relative;
295308
padding: 8px 0;
309+
padding-right: 36px;
296310
background: var(--page-background-additional);
297311
border-radius: 8px;
298312
max-height: 240px;

client_v2/src/components/Clients/blocks/PersistentClientsTable/PersistentClientsTable.tsx

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,18 @@ export const PersistentClientsTable = ({
100100
{id}
101101
</span>
102102
))}
103+
<button
104+
type="button"
105+
className={cn(
106+
s.copyBtn,
107+
s.copyBtnGreen,
108+
s.copyBtnTopRight,
109+
)}
110+
onClick={() => handleCopy(ids.join(', '))}
111+
title={intl.getMessage('copy')}
112+
>
113+
<Icon icon="copy" color="green" />
114+
</button>
103115
</div>
104116
}
105117
>
@@ -134,11 +146,11 @@ export const PersistentClientsTable = ({
134146
<span className={s.nameTooltipText}>{value}</span>
135147
<button
136148
type="button"
137-
className={s.copyBtn}
149+
className={cn(s.copyBtn, s.copyBtnGreen)}
138150
onClick={() => handleCopy(value)}
139151
title={intl.getMessage('copy')}
140152
>
141-
<Icon icon="copy" color="gray" />
153+
<Icon icon="copy" color="green" />
142154
</button>
143155
</div>
144156
}
@@ -224,7 +236,7 @@ export const PersistentClientsTable = ({
224236
},
225237
accessor: 'tags',
226238
sortable: false,
227-
render: (value: string[]) => <TagCell tags={value} />,
239+
render: (value: string[]) => <TagCell tags={value} onCopy={handleCopy} />,
228240
},
229241
{
230242
key: 'requests',

client_v2/src/components/Clients/blocks/PersistentClientsTable/TagCell.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,10 @@ import s from './PersistentClientsTable.module.pcss';
88

99
type TagCellProps = {
1010
tags: string[];
11+
onCopy?: (text: string) => void;
1112
};
1213

13-
export const TagCell = ({ tags }: TagCellProps) => {
14+
export const TagCell = ({ tags, onCopy }: TagCellProps) => {
1415
if (tags.length === 0) {
1516
return (
1617
<div className={s.cell}>
@@ -26,7 +27,7 @@ export const TagCell = ({ tags }: TagCellProps) => {
2627
<div className={s.cell}>
2728
<span className={s.cellLabel}>{intl.getMessage('tags_title')}</span>
2829
<div className={s.cellValue}>
29-
<TagsRow tags={tags} />
30+
<TagsRow tags={tags} onCopy={onCopy} />
3031
</div>
3132
</div>
3233
);

client_v2/src/components/Clients/blocks/PersistentClientsTable/TagsRow.tsx

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
import React from 'react';
2+
import cn from 'clsx';
23

4+
import intl from 'panel/common/intl';
35
import { Dropdown } from 'panel/common/ui/Dropdown';
6+
import { Icon } from 'panel/common/ui/Icon';
47

58
import s from './PersistentClientsTable.module.pcss';
69

@@ -9,9 +12,10 @@ const MAX_VISIBLE_TAGS = 1;
912
type TagsRowProps = {
1013
tags: string[];
1114
maxVisible?: number;
15+
onCopy?: (text: string) => void;
1216
};
1317

14-
export const TagsRow = ({ tags, maxVisible = MAX_VISIBLE_TAGS }: TagsRowProps) => {
18+
export const TagsRow = ({ tags, maxVisible = MAX_VISIBLE_TAGS, onCopy }: TagsRowProps) => {
1519
const visible = tags.slice(0, maxVisible);
1620
const hiddenCount = tags.length - maxVisible;
1721

@@ -33,6 +37,16 @@ export const TagsRow = ({ tags, maxVisible = MAX_VISIBLE_TAGS }: TagsRowProps) =
3337
{tag}
3438
</span>
3539
))}
40+
{onCopy && (
41+
<button
42+
type="button"
43+
className={cn(s.copyBtn, s.copyBtnGreen, s.copyBtnTopRight)}
44+
onClick={() => onCopy(tags.join(', '))}
45+
title={intl.getMessage('copy')}
46+
>
47+
<Icon icon="copy" color="green" />
48+
</button>
49+
)}
3650
</div>
3751
}
3852
>

client_v2/src/lib/theme/Select.module.pcss

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,13 @@
145145
display: flex;
146146
align-items: center;
147147
cursor: pointer;
148+
border: none;
149+
background: none;
150+
padding: 0;
151+
}
152+
153+
.clearIndicatorEnd {
154+
padding-right: 12px;
148155
}
149156

150157
.clearIcon {

0 commit comments

Comments
 (0)