mirror of
https://github.com/portainer/portainer.git
synced 2025-07-18 21:09:40 +02:00
Co-authored-by: James Player <james.player@portainer.io> Co-authored-by: Cara Ryan <cara.ryan@portainer.io> Co-authored-by: stevensbkang <skan070@gmail.com>
34 lines
692 B
TypeScript
34 lines
692 B
TypeScript
import { Loader2 } from 'lucide-react';
|
|
import { ReactNode } from 'react';
|
|
import clsx from 'clsx';
|
|
|
|
import { Icon } from '@@/Icon';
|
|
|
|
type Size = 'xs' | 'sm' | 'md';
|
|
|
|
export type Props = {
|
|
children: ReactNode;
|
|
className?: string;
|
|
size?: Size;
|
|
};
|
|
|
|
const sizeStyles: Record<Size, string> = {
|
|
xs: 'text-xs gap-1',
|
|
sm: 'text-sm gap-2',
|
|
md: 'text-md gap-2',
|
|
};
|
|
|
|
export function InlineLoader({ children, className, size = 'sm' }: Props) {
|
|
return (
|
|
<div
|
|
className={clsx(
|
|
'text-muted flex items-center',
|
|
className,
|
|
sizeStyles[size]
|
|
)}
|
|
>
|
|
<Icon icon={Loader2} className="animate-spin-slow flex-none" />
|
|
{children}
|
|
</div>
|
|
);
|
|
}
|