2023-02-06 11:28:18 -08:00
|
|
|
import clsx from 'clsx';
|
2022-11-03 16:48:10 -07:00
|
|
|
import React from 'react';
|
|
|
|
|
|
|
|
interface IIndicator {
|
2023-02-15 13:26:27 -08:00
|
|
|
state?: 'active' | 'pending' | 'error' | 'inactive'
|
|
|
|
size?: 'sm'
|
2022-11-03 16:48:10 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
/** Indicator dot component. */
|
|
|
|
const Indicator: React.FC<IIndicator> = ({ state = 'inactive', size = 'sm' }) => {
|
|
|
|
return (
|
|
|
|
<div
|
2023-02-06 11:28:18 -08:00
|
|
|
className={clsx('rounded-full outline-double', {
|
2022-11-03 16:48:10 -07:00
|
|
|
'w-1.5 h-1.5 shadow-sm': size === 'sm',
|
|
|
|
'bg-green-500 outline-green-400': state === 'active',
|
|
|
|
'bg-yellow-500 outline-yellow-400': state === 'pending',
|
|
|
|
'bg-red-500 outline-red-400': state === 'error',
|
|
|
|
'bg-neutral-500 outline-neutral-400': state === 'inactive',
|
|
|
|
})}
|
|
|
|
/>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
2023-02-06 11:28:18 -08:00
|
|
|
export default Indicator;
|