Skip to content

Commit 41873fe

Browse files
dennisvankekemsvcAPLBotgithub-advanced-security[bot]
authored
feat: workload static forms (#692)
* feat: get v2 and validator schema * feat: flattened workloads, prepare static forms * fix: type errors * feat: auto image updater * feat: digest and semver logic * fix: edit page header * fix: edit save * fix: create workloads not working * fix: semver versioning * fix: extra validator rules for name * fix: title workload * Potential fix for code scanning alert no. 15: Inefficient regular expression Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> * fix: delete workload * fix: namespace field for admin * fix: added loading submit button * fix: hook rule * feat: landing header overrides * fix: remove platform admin check * fix: workload name admin check --------- Co-authored-by: svcAPLBot <[email protected]> Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
1 parent d1b68d6 commit 41873fe

File tree

4 files changed

+523
-73
lines changed

4 files changed

+523
-73
lines changed

src/components/ImgButtonGroup.tsx

Lines changed: 30 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,20 @@ const StyledTypography = styled(Typography)<{ selected: boolean }>(({ theme, sel
2828
color: selected ? theme.palette.primary.main : theme.palette.grey[500],
2929
}))
3030

31+
const StyledCaption = styled(Typography)<{ selected: boolean }>(({ theme, selected }) => ({
32+
fontSize: 10,
33+
textTransform: 'none',
34+
color: selected ? theme.palette.primary.main : theme.palette.grey[500],
35+
marginLeft: '1px',
36+
}))
37+
3138
interface ImgButtonGroupProps {
3239
title?: string
3340
description?: string
3441
name: string
3542
control: any
3643
value: string
37-
options: { value: string; label: string; imgSrc: string }[]
44+
options: { value: string; label: string; imgSrc?: string; caption?: string }[]
3845
onChange?: (value: string) => void
3946
disabled?: boolean
4047
}
@@ -75,18 +82,29 @@ function ImgButtonGroup({
7582
}}
7683
selected={field.value === option.value}
7784
>
78-
<img
79-
style={{ width: 20, height: 20 }}
80-
src={option.imgSrc}
81-
onError={({ currentTarget }) => {
82-
// eslint-disable-next-line no-param-reassign
83-
currentTarget.onerror = null // prevents looping
84-
// eslint-disable-next-line no-param-reassign
85-
currentTarget.src = `${option.imgSrc}`
85+
{option.imgSrc && (
86+
<img
87+
style={{ width: 20, height: 20 }}
88+
src={option.imgSrc}
89+
onError={({ currentTarget }) => {
90+
// eslint-disable-next-line no-param-reassign
91+
currentTarget.onerror = null // prevents looping
92+
// eslint-disable-next-line no-param-reassign
93+
currentTarget.src = `${option.imgSrc}`
94+
}}
95+
alt={`Logo for ${option.imgSrc}`}
96+
/>
97+
)}
98+
<Box
99+
sx={{
100+
display: 'flex',
101+
flexDirection: 'column',
102+
alignItems: 'flex-start',
86103
}}
87-
alt={`Logo for ${option.imgSrc}`}
88-
/>
89-
<StyledTypography selected={field.value === option.value}>{option.label}</StyledTypography>
104+
>
105+
<StyledTypography selected={field.value === option.value}>{option.label}</StyledTypography>
106+
<StyledCaption selected={field.value === option.value}>{option.caption}</StyledCaption>
107+
</Box>
90108
</StyledButton>
91109
))}
92110
</Box>

src/components/LandingHeader.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,13 @@ import * as React from 'react'
66
import { Breadcrumb, BreadcrumbProps } from './Breadcrumb/Breadcrumb'
77
import { Button } from './Button/Button'
88
import { DocsLink } from './DocsLink'
9+
import { CrumbOverridesProps } from './Breadcrumb/Crumbs'
910

1011
export interface LandingHeaderProps {
1112
analyticsLabel?: string
1213
betaFeedbackLink?: string
1314
breadcrumbDataAttrs?: { [key: string]: boolean }
15+
breadcrumbOverrides?: CrumbOverridesProps[]
1416
breadcrumbProps?: BreadcrumbProps
1517
buttonDataAttrs?: { [key: string]: boolean | string }
1618
createButtonText?: string
@@ -38,6 +40,7 @@ export function LandingHeader({
3840
analyticsLabel,
3941
betaFeedbackLink,
4042
breadcrumbDataAttrs,
43+
breadcrumbOverrides,
4144
breadcrumbProps,
4245
buttonDataAttrs,
4346
createButtonText,
@@ -80,6 +83,7 @@ export function LandingHeader({
8083
{...breadcrumbDataAttrs}
8184
{...breadcrumbProps}
8285
disabledBreadcrumbEditButton={disabledBreadcrumbEditButton}
86+
crumbOverrides={breadcrumbOverrides}
8387
/>
8488
</Grid>
8589
{!shouldHideDocsAndCreateButtons && (

0 commit comments

Comments
 (0)