How to use the @codesandbox/notifications.NotificationState function in @codesandbox/notifications

To help you get started, we’ve selected a few @codesandbox/notifications examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github codesandbox / codesandbox-client / packages / common / src / utils / notifications.ts View on Github external
import {
  NotificationState,
  NotificationStatus,
} from '@codesandbox/notifications';

export const notificationState = new NotificationState();

export type NotificationType = 'notice' | 'success' | 'warning' | 'error';

export function convertTypeToStatus(
  type: NotificationType
): NotificationStatus {
  switch (type) {
    case 'notice':
      return NotificationStatus.NOTICE;
    case 'warning':
      return NotificationStatus.WARNING;
    case 'error':
      return NotificationStatus.ERROR;
    case 'success':
      return NotificationStatus.SUCCESS;
    default: