@patreon/studio
Version:
Patreon Studio Design System
26 lines (25 loc) • 891 B
TypeScript
import type { ContentBuilder, ToastProps } from './types';
export interface ToastData extends Pick<ToastProps, 'action' | 'data-tag' | 'duration' | 'isClosing'> {
contentBuilder: ContentBuilder;
id: number;
key: string;
}
declare type PartialToastWithIdOrKey = Partial<ToastData> & (Pick<ToastData, 'id'> | Pick<ToastData, 'key'>);
interface ReducerActionAdd {
type: 'add';
payload: ToastData;
}
interface ReducerActionUpdate {
type: 'update';
payload: PartialToastWithIdOrKey;
}
interface ReducerActionRemove {
type: 'remove';
payload: PartialToastWithIdOrKey;
}
interface ReducerActionCloseAll {
type: 'closeAll';
}
declare type ToastReducerAction = ReducerActionAdd | ReducerActionUpdate | ReducerActionRemove | ReducerActionCloseAll;
export declare const toasterReducer: (state: ToastData[], action: ToastReducerAction) => ToastData[];
export {};