You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
portainer/app/react/components/Blocklist/BlocklistItem.tsx

38 lines
842 B

import clsx from 'clsx';
import { ComponentProps, ComponentType, ElementType } from 'react';
export type AsComponentProps<E extends ElementType = ElementType> =
ComponentProps<E> & {
as?: E;
};
export function BlocklistItem<T extends ElementType>({
className,
isSelected,
children,
as = 'button',
...props
}: AsComponentProps & {
isSelected?: boolean;
as?: ComponentType<T>;
}) {
const Component = as as 'button';
return (
<Component
type="button"
className={clsx(
className,
'blocklist-item flex items-stretch overflow-hidden bg-transparent w-full !ml-0 no-link text-left',
{
'blocklist-item--selected': isSelected,
}
)}
// eslint-disable-next-line react/jsx-props-no-spreading
{...props}
>
{children}
</Component>
);
}