import { Show, createEffect, createMemo, createSignal } from 'solid-js' import { DELAY } from '~/config/enum' import { useProxies } from '~/signals/proxies' const Delay = (props: { name?: string }) => { const { delayMap } = useProxies() const [textClassName, setTextClassName] = createSignal('') const delay = createMemo(() => { return delayMap()[props.name!] }) createEffect(() => { setTextClassName('text-success') if (delay() > DELAY.HIGH) { setTextClassName('text-error') } else if (delay() > DELAY.MEDIUM) { setTextClassName('text-warning') } }) return ( <> {delay()}ms ) } export default Delay