UNPKG

@redocly/theme

Version:

Shared UI components lib

21 lines (16 loc) 440 B
import type { ToastType } from '../types/toast'; const SIMPLE_TOAST_DURATION_MS = 2500; const DETAILED_TOAST_DURATION_MS = 4000; export function getAutoDismissDuration( hasDetails: boolean, type: ToastType, duration?: number, ): number | null { if (duration !== undefined) { return duration; } if (type === 'loading') { return null; } return hasDetails ? DETAILED_TOAST_DURATION_MS : SIMPLE_TOAST_DURATION_MS; }