import clsx from 'clsx'; import { ReadyState } from 'react-use-websocket'; export interface WSStatusProps { state: ReadyState } function StatusTag ({ title, color, }: { title: string color: 'success' | 'primary' | 'warning' }) { const textClassName = `text-${color} text-sm`; const bgClassName = `bg-${color}`; return (
{title}
); } export default function WSStatus ({ state }: WSStatusProps) { if (state === ReadyState.OPEN) { return ; } if (state === ReadyState.CLOSED) { return ; } if (state === ReadyState.CONNECTING) { return ; } if (state === ReadyState.CLOSING) { return ; } return null; }