Skip to content

Commit

Permalink
Add Helm charts values schema badge (#3772)
Browse files Browse the repository at this point in the history
Signed-off-by: Cintia Sanchez Garcia <[email protected]>
  • Loading branch information
cynthia-sg authored Apr 17, 2024
1 parent f83b553 commit 06c668d
Show file tree
Hide file tree
Showing 14 changed files with 413 additions and 9 deletions.
7 changes: 7 additions & 0 deletions web/src/layout/common/PackageCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import CNCF from './badges/CNCF';
import Deprecated from './badges/Deprecated';
import Official from './badges/Official';
import Signed from './badges/Signed';
import ValuesSchemaBadge from './badges/ValuesSchema';
import VerifiedPublisher from './badges/VerifiedPublisher';
import styles from './PackageCard.module.css';
import PackageCategoryLabel from './PackageCategoryLabel';
Expand Down Expand Up @@ -273,6 +274,12 @@ const PackageCard = (props: Props) => {
<div className="d-flex flex-row ms-auto">
{props.package.deprecated && <Deprecated className="d-inline mt-3 ms-2" />}
{(props.package.cncf || props.package.repository.cncf) && <CNCF className="d-inline mt-3 ms-2" />}
{props.package.repository.kind === RepositoryKind.Helm && (
<ValuesSchemaBadge
hasValuesSchema={props.package.hasValuesSchema || false}
className="d-inline mt-3 ms-2"
/>
)}
<Signed
signed={props.package.signed}
signatures={props.package.signatures}
Expand Down
157 changes: 157 additions & 0 deletions web/src/layout/common/__snapshots__/PackageCard.test.tsx.snap

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

42 changes: 42 additions & 0 deletions web/src/layout/common/badges/ValuesSchema.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import { isNull, isUndefined } from 'lodash';
import { CgListTree } from 'react-icons/cg';

import Badge from './Badge';

interface Props {
hasValuesSchema: boolean;
className?: string;
dropdownAlignment?: 'start' | 'end';
noDropdown?: boolean;
smallSize?: boolean;
}

const ValuesSchemaBadge = (props: Props) => {
const hasValuesSchema =
!isNull(props.hasValuesSchema) && !isUndefined(props.hasValuesSchema) && props.hasValuesSchema;

return (
<Badge
title="Values Schema"
bgColor="#FCA311"
icon={<CgListTree />}
active={hasValuesSchema}
className={props.className}
dropdownAlignment={props.dropdownAlignment}
noDropdown={props.noDropdown}
smallSize={props.smallSize}
popoverContent={
<>
<div className="fs-6 fw-semibold border-bottom border-1 mb-3 pb-1">Values schema</div>

<p>
This chart {hasValuesSchema ? 'provides' : 'does not provide'} a{' '}
<span className="fw-bold">values schema</span>.
</p>
</>
}
/>
);
};

export default ValuesSchemaBadge;
157 changes: 157 additions & 0 deletions web/src/layout/package/__snapshots__/index.test.tsx.snap

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 06c668d

Please sign in to comment.