mirror of
https://github.com/portainer/portainer.git
synced 2025-07-19 05:19:39 +02:00
Some checks failed
ci / build_images (map[arch:amd64 platform:linux version:]) (push) Has been cancelled
ci / build_images (map[arch:amd64 platform:windows version:1809]) (push) Has been cancelled
ci / build_images (map[arch:amd64 platform:windows version:ltsc2022]) (push) Has been cancelled
ci / build_images (map[arch:arm platform:linux version:]) (push) Has been cancelled
ci / build_images (map[arch:arm64 platform:linux version:]) (push) Has been cancelled
ci / build_images (map[arch:ppc64le platform:linux version:]) (push) Has been cancelled
ci / build_images (map[arch:s390x platform:linux version:]) (push) Has been cancelled
/ triage (push) Has been cancelled
Test / test-server (map[arch:amd64 platform:windows version:1809]) (push) Has been cancelled
Test / test-server (map[arch:amd64 platform:windows version:ltsc2022]) (push) Has been cancelled
Test / test-server (map[arch:arm64 platform:linux]) (push) Has been cancelled
Lint / Run linters (push) Has been cancelled
Test / test-client (push) Has been cancelled
Test / test-server (map[arch:amd64 platform:linux]) (push) Has been cancelled
ci / build_manifests (push) Has been cancelled
Co-authored-by: testa113 <testa113>
41 lines
1.2 KiB
TypeScript
41 lines
1.2 KiB
TypeScript
import { ChevronDown } from 'lucide-react';
|
|
import { ComponentProps } from 'react';
|
|
import clsx from 'clsx';
|
|
|
|
import { Icon } from './Icon';
|
|
|
|
export function CollapseExpandButton({
|
|
onClick,
|
|
isExpanded,
|
|
...props
|
|
}: { isExpanded: boolean } & ComponentProps<'button'>) {
|
|
return (
|
|
<button
|
|
onClick={(e) => {
|
|
e.preventDefault();
|
|
e.stopPropagation();
|
|
|
|
onClick?.(e);
|
|
}}
|
|
color="none"
|
|
title={isExpanded ? 'Collapse' : 'Expand'}
|
|
aria-label={isExpanded ? 'Collapse' : 'Expand'}
|
|
aria-expanded={isExpanded}
|
|
type="button"
|
|
className="flex-none border-none bg-transparent flex items-center p-0 !ml-0 group"
|
|
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
{...props}
|
|
>
|
|
<div className="flex items-center group-hover:bg-blue-5 be:group-hover:bg-gray-5 group-hover:th-dark:bg-gray-true-7 group-hover:bg-opacity-10 be:group-hover:bg-opacity-10 rounded-full p-[3px] transition ease-in-out">
|
|
<Icon
|
|
icon={ChevronDown}
|
|
size="md"
|
|
className={clsx('transition ease-in-out', {
|
|
'rotate-180': isExpanded,
|
|
'rotate-0': !isExpanded,
|
|
})}
|
|
/>
|
|
</div>
|
|
</button>
|
|
);
|
|
}
|