diff --git a/playground/src/components/ToastCode.tsx b/playground/src/components/ToastCode.tsx index 2d0f8ce0..d4ab7b4f 100644 --- a/playground/src/components/ToastCode.tsx +++ b/playground/src/components/ToastCode.tsx @@ -1,21 +1,9 @@ import * as React from 'react'; -import { themes } from './constants'; +import { themes, typeMap } from './constants'; function getType(type: string) { - switch (type) { - case 'default': - default: - return 'toast'; - case 'success': - return 'toast.success'; - case 'error': - return 'toast.error'; - case 'info': - return 'toast.info'; - case 'warning': - return 'toast.warn'; - } + return typeMap[type] || typeMap.default } export interface ToastCodeProps { diff --git a/playground/src/components/constants.ts b/playground/src/components/constants.ts index c5279417..ba09ca0d 100644 --- a/playground/src/components/constants.ts +++ b/playground/src/components/constants.ts @@ -44,6 +44,14 @@ export const transitions = { export const themes = ['light', 'dark', 'colored']; +export const typeMap = { + default: 'toast', + success: 'toast.success', + error: 'toast.error', + info: 'toast.info', + warning: 'toast.warn' +}; + export const positions = { TOP_LEFT: 'top-left', TOP_RIGHT: 'top-right', @@ -59,4 +67,4 @@ export const typs = { WARNING: 'warning', ERROR: 'error', DEFAULT: 'default' -}; +}; \ No newline at end of file