Skip to content

Commit 20cb06a

Browse files
committed
feat: add RegistryIcon component & replace instances of dc__registry-icon scss class with it
1 parent 7c65442 commit 20cb06a

File tree

17 files changed

+201
-22
lines changed

17 files changed

+201
-22
lines changed

src/Assets/IconV2/ic-azure.svg

Lines changed: 23 additions & 0 deletions
Loading

src/Assets/IconV2/ic-container.svg

Lines changed: 19 additions & 0 deletions
Loading

src/Assets/IconV2/ic-dockerhub.svg

Lines changed: 3 additions & 0 deletions
Loading

src/Assets/IconV2/ic-ecr.svg

Lines changed: 9 additions & 0 deletions
Loading

src/Assets/IconV2/ic-github.svg

Lines changed: 2 additions & 4 deletions
Loading

src/Assets/IconV2/ic-google-artifact-registry.svg

Lines changed: 25 additions & 0 deletions
Loading

src/Assets/IconV2/ic-google-container-registry.svg

Lines changed: 25 additions & 0 deletions
Loading

src/Assets/IconV2/ic-quay.svg

Lines changed: 11 additions & 0 deletions
Loading

src/Common/Constants.ts

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

17+
import { RegistryType } from '@Shared/types'
1718
import { RegistryTypeDetailType } from './Types'
1819
import { getContainerRegistryIcon } from './utils'
1920

@@ -237,7 +238,7 @@ export const REGISTRY_TYPE_MAP: Record<string, RegistryTypeDetailType> = {
237238
defaultValue: '',
238239
placeholder: '',
239240
},
240-
startIcon: getContainerRegistryIcon('ecr'),
241+
startIcon: getContainerRegistryIcon(RegistryType.ECR),
241242
},
242243
'docker-hub': {
243244
value: 'docker-hub',
@@ -261,7 +262,7 @@ export const REGISTRY_TYPE_MAP: Record<string, RegistryTypeDetailType> = {
261262
defaultValue: '',
262263
placeholder: '',
263264
},
264-
startIcon: getContainerRegistryIcon('docker-hub'),
265+
startIcon: getContainerRegistryIcon(RegistryType.DOCKER_HUB),
265266
},
266267
acr: {
267268
value: 'acr',
@@ -286,7 +287,7 @@ export const REGISTRY_TYPE_MAP: Record<string, RegistryTypeDetailType> = {
286287
defaultValue: '',
287288
placeholder: '',
288289
},
289-
startIcon: getContainerRegistryIcon('acr'),
290+
startIcon: getContainerRegistryIcon(RegistryType.ACR),
290291
},
291292
'artifact-registry': {
292293
value: 'artifact-registry',
@@ -310,7 +311,7 @@ export const REGISTRY_TYPE_MAP: Record<string, RegistryTypeDetailType> = {
310311
defaultValue: '',
311312
placeholder: 'Paste json file content here',
312313
},
313-
startIcon: getContainerRegistryIcon('artifact-registry'),
314+
startIcon: getContainerRegistryIcon(RegistryType.ARTIFACT_REGISTRY),
314315
},
315316
gcr: {
316317
value: 'gcr',
@@ -334,7 +335,7 @@ export const REGISTRY_TYPE_MAP: Record<string, RegistryTypeDetailType> = {
334335
defaultValue: '',
335336
placeholder: 'Paste json file content here',
336337
},
337-
startIcon: getContainerRegistryIcon('gcr'),
338+
startIcon: getContainerRegistryIcon(RegistryType.GCR),
338339
},
339340
quay: {
340341
value: 'quay',
@@ -358,7 +359,7 @@ export const REGISTRY_TYPE_MAP: Record<string, RegistryTypeDetailType> = {
358359
defaultValue: '',
359360
placeholder: '',
360361
},
361-
startIcon: getContainerRegistryIcon('quay'),
362+
startIcon: getContainerRegistryIcon(RegistryType.QUAY),
362363
},
363364
other: {
364365
value: 'other',
@@ -382,7 +383,7 @@ export const REGISTRY_TYPE_MAP: Record<string, RegistryTypeDetailType> = {
382383
defaultValue: '',
383384
placeholder: '',
384385
},
385-
startIcon: getContainerRegistryIcon('other'),
386+
startIcon: getContainerRegistryIcon(RegistryType.OTHER),
386387
},
387388
}
388389

src/Common/utils.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
export const getContainerRegistryIcon = (registryValue: string): JSX.Element => (
18-
<div className={`dc__registry-icon ${registryValue}`} />
19-
)
17+
import { RegistryIcon } from '@Shared/Components'
18+
import { RegistryType } from '@Shared/types'
19+
20+
export const getContainerRegistryIcon = (registryType: RegistryType) => <RegistryIcon registryType={registryType} />

0 commit comments

Comments
 (0)