Skip to content
Permalink
Browse files
feat(alert): created and exported the default timeout and classnames
  • Loading branch information
mlaursen committed Aug 20, 2020
1 parent 0bacc6e commit 32bacc9000ea7c9633e437ce6eabb27606c7d7f0
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 11 deletions.
@@ -4,6 +4,8 @@ import CSSTransition from "react-transition-group/CSSTransition";
import { OverridableCSSTransitionProps } from "@react-md/transition";
import { bem } from "@react-md/utils";

import { DEFAULT_TOAST_CLASSNAMES, DEFAULT_TOAST_TIMEOUT } from "./constants";

export interface ToastProps
extends HTMLAttributes<HTMLDivElement>,
Omit<OverridableCSSTransitionProps, "mountOnEnter" | "unmountOnExit"> {
@@ -33,16 +35,6 @@ export interface ToastProps
}

const block = bem("rmd-toast");
const DEFAULT_TOAST_CLASSNAMES = {
appear: "rmd-toast--enter",
appearActive: "rmd-toast--enter-active",
enter: "rmd-toast--enter",
enterActive: "rmd-toast--enter-active",
enterDone: "",
exit: "rmd-toast--exit",
exitActive: "rmd-toast--exit-active",
exitDone: "",
};

/**
* This is a very low-level component that can be used to animate a new toast in
@@ -62,7 +54,7 @@ const Toast = forwardRef<HTMLDivElement, ToastProps>(function Toast(
onExit,
onExiting,
onExited,
timeout = 150,
timeout = DEFAULT_TOAST_TIMEOUT,
classNames = DEFAULT_TOAST_CLASSNAMES,
action = null,
stacked = false,
@@ -0,0 +1,12 @@
import { CSSTransitionClassNames } from "react-transition-group/CSSTransition";
import { TransitionTimeout } from "@react-md/transition";

export const DEFAULT_TOAST_TIMEOUT: TransitionTimeout = 150;
export const DEFAULT_TOAST_CLASSNAMES: CSSTransitionClassNames = {
appear: "rmd-toast--enter",
appearActive: "rmd-toast--enter-active",
enter: "rmd-toast--enter",
enterActive: "rmd-toast--enter-active",
exit: "rmd-toast--exit",
exitActive: "rmd-toast--exit-active",
};
@@ -8,3 +8,4 @@ export { default as MessageQueue } from "./MessageQueue";
export * from "./MessageQueue";

export * from "./MessageQueueContext";
export * from "./constants";

0 comments on commit 32bacc9

Please sign in to comment.