saleor-dashboard/src/components/messages/index.ts
Dominik Żegleń df5aea6200
Add product export (#620)
* Add component backbone

* Make step component generic and typed

* Add step tabs

* Add settings view

* Encapsulate all dialog components in one directory

* Move types to separate file

* Add mutations

* Use gql types

* Add error handling

* Do not keep separate types file

* Allow products to be exported

* Fix types

* Update snapshots

* Update to latest schema

* Add disabled option

* Use wizard hook

* Update type definitions

* Queue export check task

* Fix bug causing jobs to be endless and duplicated

* Fix minor bugs

* Add accordion component

* Allow selection of fields  to be exported

* Add attribute export

* Update snapshots

* Update messages

* Update changelog

* Add missing key

* Add quick peek to accordioin

* Sort imports

* Remove unused files

* Add chiips to attribute selection

* Change menu positioning

* Add product counter

* Add select all option

* Update snapshots

* Update messages

* Remove unused import

* Add chips

* Add test tags

* Update snapshots

* Change number of max chips

* Add accordion tags

* Update messages
2020-07-30 11:54:16 +02:00

48 lines
1.1 KiB
TypeScript

import { createContext } from "react";
export type Status = "success" | "error" | "info" | "warning";
export interface IMessage {
actionBtn?: {
label: string;
action: () => void;
};
autohide?: number;
expandText?: string;
title?: string;
text: React.ReactNode;
onUndo?: () => void;
status?: Status;
}
export interface INotification {
id: number;
message: IMessage;
timeout: number;
close: () => void;
}
export interface ITimer {
id: number;
notification: INotification;
remaining: number;
start: number;
timeoutId: number;
}
export const types = {
ERROR: "error",
INFO: "info",
SUCCESS: "success",
WARNING: "warning"
};
export interface INotificationContext {
show: (message: IMessage, timeout?: number | null) => void;
remove: (notification: INotification) => void;
}
export type IMessageContext = (message: IMessage) => void;
export const MessageContext = createContext<INotificationContext>(null);
export * from "./MessageManager";
export * from "./MessageManagerProvider";
export { default } from "./MessageManagerProvider";