1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-07-24 15:59:41 +02:00

refactor(registries): migrate list view to react [EE-4704] (#10687)

This commit is contained in:
Chaim Lev-Ari 2024-04-08 17:22:43 +03:00 committed by GitHub
parent 9600eb6fa1
commit f584bf3830
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
61 changed files with 504 additions and 490 deletions

View file

@ -1,4 +1,4 @@
import { PropsWithChildren } from 'react';
import { ReactNode } from 'react';
import clsx from 'clsx';
import { Briefcase } from 'lucide-react';
@ -11,32 +11,39 @@ import { Icon } from '@@/Icon';
import { getFeatureDetails } from './utils';
export interface Props {
featureId?: FeatureId;
featureId: FeatureId;
showIcon?: boolean;
className?: string;
children?: (isLimited: boolean) => ReactNode;
}
export function BEFeatureIndicator({
featureId,
children,
children = () => null,
showIcon = true,
className = '',
}: PropsWithChildren<Props>) {
const { url, limitedToBE } = getFeatureDetails(featureId);
}: Props) {
const { url, limitedToBE = false } = getFeatureDetails(featureId);
if (!limitedToBE) {
return null;
}
return (
<a
className={clsx('be-indicator vertical-center text-xs', className)}
href={url}
target="_blank"
rel="noopener noreferrer"
>
{children}
{showIcon && <Icon icon={Briefcase} className="be-indicator-icon mr-1" />}
<span className="be-indicator-label break-words">Business Feature</span>
</a>
<>
{limitedToBE && (
<a
className={clsx('be-indicator vertical-center text-xs', className)}
href={url}
target="_blank"
rel="noopener noreferrer"
>
{showIcon && (
<Icon icon={Briefcase} className="be-indicator-icon mr-1" />
)}
<span className="be-indicator-label break-words">
Business Feature
</span>
</a>
)}
{children(limitedToBE)}
</>
);
}