Skip to content

Commit

Permalink
fix #494
Browse files Browse the repository at this point in the history
  • Loading branch information
fkhadra committed Jul 2, 2020
1 parent c0cfe08 commit b4d2c25
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 12 deletions.
9 changes: 8 additions & 1 deletion src/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@ type Nullable<T> = {
[P in keyof T]: T[P] | null;
};

export type TypeOptions =
| 'info'
| 'success'
| 'warning'
| 'error'
| 'default'
| 'dark';

export type ToastPosition =
| 'top-right'
| 'top-center'
Expand All @@ -15,7 +23,6 @@ export type ToastPosition =
export interface ToastContentProps {
closeToast?: () => void;
}
export type TypeOptions = 'info' | 'success' | 'warning' | 'error' | 'default';
export type ToastContent =
| React.ReactNode
| ((props: ToastContentProps) => React.ReactNode);
Expand Down
25 changes: 14 additions & 11 deletions src/utils/constant.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,25 @@
export type TypeOptions = 'info' | 'success' | 'warning' | 'error' | 'default';
export type Positons =
| 'top-left'
| 'top-right'
| 'top-center'
| 'bottom-left'
| 'bottom-right'
| 'bottom-center';
import { ToastPosition, TypeOptions } from '../types';

export const POSITION = {
type KeyOfPosition =
| 'TOP_LEFT'
| 'TOP_RIGHT'
| 'TOP_CENTER'
| 'BOTTOM_LEFT'
| 'BOTTOM_RIGHT'
| 'BOTTOM_CENTER';

type KeyOfType = 'INFO' | 'SUCCESS' | 'WARNING' | 'ERROR' | 'DEFAULT' | 'DARK';

export const POSITION: { [key in KeyOfPosition]: ToastPosition } = {
TOP_LEFT: 'top-left',
TOP_RIGHT: 'top-right',
TOP_CENTER: 'top-center',
BOTTOM_LEFT: 'bottom-left',
BOTTOM_RIGHT: 'bottom-right',
BOTTOM_CENTER: 'bottom-center'
} as const;
};

export const TYPE = {
export const TYPE: { [key in KeyOfType]: TypeOptions } = {
INFO: 'info',
SUCCESS: 'success',
WARNING: 'warning',
Expand Down

0 comments on commit b4d2c25

Please sign in to comment.