Skip to content

Commit 52daa53

Browse files
authored
Merge pull request #283 from devtron-labs/feat/replace-select-picker
chore: menu with modification from select picker
2 parents 0291406 + 4c11d28 commit 52daa53

File tree

7 files changed

+32
-11
lines changed

7 files changed

+32
-11
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.4",
3+
"version": "0.3.5",
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'
@@ -207,6 +208,7 @@ export const REGISTRY_TYPE_MAP: Record<string, RegistryTypeDetailType> = {
207208
defaultValue: '',
208209
placeholder: '',
209210
},
211+
startIcon: getContainerRegistryIcon('ecr'),
210212
},
211213
'docker-hub': {
212214
value: 'docker-hub',
@@ -230,6 +232,7 @@ export const REGISTRY_TYPE_MAP: Record<string, RegistryTypeDetailType> = {
230232
defaultValue: '',
231233
placeholder: '',
232234
},
235+
startIcon: getContainerRegistryIcon('docker-hub'),
233236
},
234237
acr: {
235238
value: 'acr',
@@ -254,6 +257,7 @@ export const REGISTRY_TYPE_MAP: Record<string, RegistryTypeDetailType> = {
254257
defaultValue: '',
255258
placeholder: '',
256259
},
260+
startIcon: getContainerRegistryIcon('acr'),
257261
},
258262
'artifact-registry': {
259263
value: 'artifact-registry',
@@ -277,6 +281,7 @@ export const REGISTRY_TYPE_MAP: Record<string, RegistryTypeDetailType> = {
277281
defaultValue: '',
278282
placeholder: 'Paste json file content here',
279283
},
284+
startIcon: getContainerRegistryIcon('artifact-registry'),
280285
},
281286
gcr: {
282287
value: 'gcr',
@@ -300,6 +305,7 @@ export const REGISTRY_TYPE_MAP: Record<string, RegistryTypeDetailType> = {
300305
defaultValue: '',
301306
placeholder: 'Paste json file content here',
302307
},
308+
startIcon: getContainerRegistryIcon('gcr'),
303309
},
304310
quay: {
305311
value: 'quay',
@@ -323,6 +329,7 @@ export const REGISTRY_TYPE_MAP: Record<string, RegistryTypeDetailType> = {
323329
defaultValue: '',
324330
placeholder: '',
325331
},
332+
startIcon: getContainerRegistryIcon('quay'),
326333
},
327334
other: {
328335
value: 'other',
@@ -346,6 +353,7 @@ export const REGISTRY_TYPE_MAP: Record<string, RegistryTypeDetailType> = {
346353
defaultValue: '',
347354
placeholder: '',
348355
},
356+
startIcon: getContainerRegistryIcon('other'),
349357
},
350358
}
351359

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/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,

0 commit comments

Comments
 (0)