mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-01-16 14:06:49 +01:00
24 lines
658 B
TypeScript
24 lines
658 B
TypeScript
import classnames from 'classnames';
|
|
import type { ComponentChildren } from 'preact';
|
|
|
|
interface Props {
|
|
statusCode: number;
|
|
children: ComponentChildren;
|
|
}
|
|
|
|
export function StatusColor({ statusCode, children }: Props) {
|
|
return (
|
|
<span
|
|
className={classnames(
|
|
statusCode >= 100 && statusCode < 200 && 'text-green-600',
|
|
statusCode >= 200 && statusCode < 300 && 'text-green-600',
|
|
statusCode >= 300 && statusCode < 400 && 'text-pink-600',
|
|
statusCode >= 400 && statusCode < 500 && 'text-orange-600',
|
|
statusCode >= 500 && statusCode < 600 && 'text-red-600',
|
|
)}
|
|
>
|
|
{children}
|
|
</span>
|
|
);
|
|
}
|