Skip to content

Commit 601e7c9

Browse files
committed
Merge branch 'develop' of https://github.com/devtron-labs/devtron-fe-common-lib into feat/security-modal
2 parents d51d3bc + 52daa53 commit 601e7c9

File tree

13 files changed

+61
-18
lines changed

13 files changed

+61
-18
lines changed

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@devtron-labs/devtron-fe-common-lib",
3-
"version": "0.3.3-beta-3",
3+
"version": "0.3.5-beta-3",
44
"description": "Supporting common component library",
55
"type": "module",
66
"main": "dist/index.js",

src/Common/Constants.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
*/
1616

1717
import { RegistryTypeDetailType } from './Types'
18+
import { getContainerRegistryIcon } from './utils'
1819

1920
export const FALLBACK_REQUEST_TIMEOUT = 60000
2021
export const Host = window?.__ORCHESTRATOR_ROOT__ ?? '/orchestrator'
@@ -209,6 +210,7 @@ export const REGISTRY_TYPE_MAP: Record<string, RegistryTypeDetailType> = {
209210
defaultValue: '',
210211
placeholder: '',
211212
},
213+
startIcon: getContainerRegistryIcon('ecr'),
212214
},
213215
'docker-hub': {
214216
value: 'docker-hub',
@@ -232,6 +234,7 @@ export const REGISTRY_TYPE_MAP: Record<string, RegistryTypeDetailType> = {
232234
defaultValue: '',
233235
placeholder: '',
234236
},
237+
startIcon: getContainerRegistryIcon('docker-hub'),
235238
},
236239
acr: {
237240
value: 'acr',
@@ -256,6 +259,7 @@ export const REGISTRY_TYPE_MAP: Record<string, RegistryTypeDetailType> = {
256259
defaultValue: '',
257260
placeholder: '',
258261
},
262+
startIcon: getContainerRegistryIcon('acr'),
259263
},
260264
'artifact-registry': {
261265
value: 'artifact-registry',
@@ -279,6 +283,7 @@ export const REGISTRY_TYPE_MAP: Record<string, RegistryTypeDetailType> = {
279283
defaultValue: '',
280284
placeholder: 'Paste json file content here',
281285
},
286+
startIcon: getContainerRegistryIcon('artifact-registry'),
282287
},
283288
gcr: {
284289
value: 'gcr',
@@ -302,6 +307,7 @@ export const REGISTRY_TYPE_MAP: Record<string, RegistryTypeDetailType> = {
302307
defaultValue: '',
303308
placeholder: 'Paste json file content here',
304309
},
310+
startIcon: getContainerRegistryIcon('gcr'),
305311
},
306312
quay: {
307313
value: 'quay',
@@ -325,6 +331,7 @@ export const REGISTRY_TYPE_MAP: Record<string, RegistryTypeDetailType> = {
325331
defaultValue: '',
326332
placeholder: '',
327333
},
334+
startIcon: getContainerRegistryIcon('quay'),
328335
},
329336
other: {
330337
value: 'other',
@@ -348,6 +355,7 @@ export const REGISTRY_TYPE_MAP: Record<string, RegistryTypeDetailType> = {
348355
defaultValue: '',
349356
placeholder: '',
350357
},
358+
startIcon: getContainerRegistryIcon('other'),
351359
},
352360
}
353361

src/Common/Types.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
import React, { ReactNode, CSSProperties } from 'react'
17+
import React, { ReactNode, CSSProperties, ReactElement } from 'react'
1818
import { Placement } from 'tippy.js'
1919
import { UserGroupDTO } from '@Pages/GlobalConfigurations'
2020
import { ImageComment, ReleaseTag } from './ImageTags.Types'
@@ -726,6 +726,7 @@ export interface RegistryTypeDetailType {
726726
registryURL: InputDetailType
727727
id: InputDetailType
728728
password: InputDetailType
729+
startIcon: ReactElement
729730
}
730731

731732
export interface UseSearchString {

src/Common/utils.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export const getContainerRegistryIcon = (registryValue: string): JSX.Element => (
2+
<div className={`dc__registry-icon dc__git-logo ${registryValue}`} />
3+
)

src/Shared/Components/Button/Button.component.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ const ButtonElement = ({
2828
| 'dataTestId'
2929
| 'isLoading'
3030
| 'ariaLabel'
31+
| 'showAriaLabelInTippy'
3132
> & {
3233
className: string
3334
'data-testid': ButtonProps['dataTestId']
@@ -135,6 +136,7 @@ const Button = ({
135136
tooltipProps = {},
136137
icon = null,
137138
ariaLabel = null,
139+
showAriaLabelInTippy = true,
138140
...props
139141
}: ButtonProps) => {
140142
const isDisabled = disabled || isLoading
@@ -144,7 +146,8 @@ const Button = ({
144146
})}`
145147

146148
const getTooltipProps = (): TooltipProps => {
147-
if (!showTooltip && icon && ariaLabel) {
149+
// Show the aria label as tippy only if the action based tippy is not to be shown
150+
if (!showTooltip && showAriaLabelInTippy && icon && ariaLabel) {
148151
return {
149152
alwaysShowTippyOnHover: true,
150153
content: ariaLabel,

src/Shared/Components/Button/constants.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export const BUTTON_SIZE_TO_CLASS_NAME_MAP: Record<ButtonProps['size'], string>
66
[ComponentSizeType.xs]: 'px-9 py-1 fs-12 lh-20 fw-6 dc__gap-6 mw-48',
77
[ComponentSizeType.small]: 'px-9 py-3 fs-12 lh-20 fw-6 dc__gap-8 mw-48',
88
[ComponentSizeType.medium]: 'px-11 py-5 fs-13 lh-20 fw-6 dc__gap-8 mw-48',
9-
[ComponentSizeType.large]: 'px-13 py-7 fs-13 lh-20 fw-6 dc__gap-10 mw-64',
9+
[ComponentSizeType.large]: 'px-13 py-7 fs-13 lh-20 fw-6 dc__gap-8 mw-64',
1010
[ComponentSizeType.xl]: 'px-15 py-9 fs-14 lh-20 fw-6 dc__gap-12 mw-64',
1111
} as const
1212

src/Shared/Components/Button/types.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ export type ButtonProps = (
105105
| {
106106
icon?: never
107107
ariaLabel?: never
108+
showAriaLabelInTippy?: never
108109
/**
109110
* Text to be displayed in the button
110111
*/
@@ -123,6 +124,12 @@ export type ButtonProps = (
123124
* If provided, icon button is rendered
124125
*/
125126
icon: ReactElement
127+
/**
128+
* If false, the ariaLabel is not shown in tippy
129+
*
130+
* @default true
131+
*/
132+
showAriaLabelInTippy?: boolean
126133
/**
127134
* Label for the icon button for accessibility.
128135
* Shown on hover in tooltip if tippy is not provided explicitly

src/Shared/Components/KeyValueTable/KeyValueTable.component.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,7 @@ export const KeyValueTable = <K extends string>({
392392
) : (
393393
<div
394394
key={key}
395-
className={`bcn-50 cn-9 fs-13 lh-20 py-8 px-12 fw-6 flexbox dc__align-items-center dc__content-space dc__gap-2 ${key === firstHeaderKey ? `${hasRows ? 'dc__top-left-radius' : 'dc__left-radius-4'}` : `${hasRows ? 'dc__top-right-radius' : 'dc__right-radius-4'}`} ${className || ''}`}
395+
className={`bcn-50 cn-9 fs-13 lh-20 py-8 px-12 fw-6 flexbox dc__align-items-center dc__content-space dc__gap-2 ${key === firstHeaderKey ? `${hasRows ? 'dc__top-left-radius' : 'dc__left-radius-4'}` : `${hasRows ? 'dc__top-right-radius-4' : 'dc__right-radius-4'}`} ${className || ''}`}
396396
>
397397
{label}
398398
{!!headerComponent && headerComponent}

src/Shared/Components/SelectPicker/utils.ts

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,24 @@ import { SelectPickerOptionType, SelectPickerProps, SelectPickerVariantType } fr
2121

2222
const getMenuWidthFromSize = <OptionValue, IsMulti extends boolean>(
2323
menuSize: SelectPickerProps<OptionValue, IsMulti>['menuSize'],
24-
): string => {
24+
): { width: string; minWidth: string } => {
2525
switch (menuSize) {
2626
case ComponentSizeType.medium:
27-
return '125%'
27+
return {
28+
width: '125%',
29+
minWidth: '250px',
30+
}
2831
case ComponentSizeType.large:
29-
return '150%'
32+
return {
33+
width: '150%',
34+
minWidth: '300px',
35+
}
3036
case ComponentSizeType.small:
3137
default:
32-
return '100%'
38+
return {
39+
width: '100%',
40+
minWidth: '200px',
41+
}
3342
}
3443
}
3544

@@ -95,8 +104,8 @@ export const getCommonSelectStyle = <OptionValue, IsMulti extends boolean>({
95104
backgroundColor: 'var(--N0)',
96105
border: '1px solid var(--N200)',
97106
boxShadow: '0px 2px 4px 0px rgba(0, 0, 0, 0.20)',
98-
width: getMenuWidthFromSize(menuSize),
99-
minWidth: '200px',
107+
width: getMenuWidthFromSize(menuSize).width,
108+
minWidth: getMenuWidthFromSize(menuSize).minWidth,
100109
zIndex: 'var(--select-picker-menu-index)',
101110
...(shouldMenuAlignRight && {
102111
right: 0,

src/Shared/Services/ToastManager/ToastContent.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export const ToastContent = ({
99
}: Pick<ToastProps, 'title' | 'description' | 'buttonProps'>) => (
1010
<div className="flexbox-col dc__gap-8 custom-toast__content">
1111
<div className="flexbox-col dc__gap-4">
12-
<h3 className="m-0 fs-13 fw-6 lh-20 cn-0 dc__truncate">{title}</h3>
12+
<h3 className="m-0 fs-13 fw-6 lh-20 cn-0 dc__ellipsis-right__2nd-line">{title}</h3>
1313
<p className="fs-12 fw-4 lh-18 m-0 dc__truncate--clamp-6">{description}</p>
1414
</div>
1515
{buttonProps && (

src/Shared/Services/ToastManager/constants.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,9 @@ export const TOAST_BASE_CONFIG: ToastContainerProps = {
2727
dataTestId="close-toast"
2828
ariaLabel="Close toast"
2929
size={ComponentSizeType.xs}
30-
variant={ButtonVariantType.text}
30+
variant={ButtonVariantType.borderLess}
3131
style={ButtonStyleType.neutral}
32+
showAriaLabelInTippy={false}
3233
/>
3334
</div>
3435
),

src/Shared/Services/ToastManager/toastManager.scss

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
@import 'react-toastify/dist/ReactToastify.css';
22

33
.Toastify {
4+
&__toast {
5+
gap: 8px;
6+
}
7+
48
&__toast-container {
59
padding: 0;
610
width: 280px;
@@ -63,9 +67,16 @@
6367

6468
// Custom styling for close btn
6569
&__close-btn {
66-
svg {
67-
use {
68-
fill: var(--N0) !important;
70+
button {
71+
svg {
72+
use {
73+
fill: var(--N0) !important;
74+
}
75+
}
76+
77+
&:hover,
78+
&:active {
79+
background: #fff3 !important;
6980
}
7081
}
7182
}

0 commit comments

Comments
 (0)