UNPKG

@totalsoft/rocket-ui

Version:

A set of reusable and composable React components built on top of Material UI core for developing fast and friendly web applications interfaces.

32 lines (28 loc) 1.01 kB
// Copyright (c) TotalSoft. // This source code is licensed under the MIT license. import { always, cond, equals, T } from 'ramda' import { Bounce, Flip, ToastOptions as ToastOptionsBase, ToastContainerProps as ToastContainerPropsBase, Slide, Zoom } from 'react-toastify' export type TextFontSize = 'small' | 'medium' | 'large' export interface ToastContainerProps extends Omit<ToastContainerPropsBase, 'transition' | 'textSize'> { /** * The appearance effect. * @default Slide */ transitionType?: 'Slide' | 'Bounce' | 'Zoom' | 'Flip', /** * The size of the toast content text. * @default 'small' */ textSize?: TextFontSize } export type ToastOptions = Omit<ToastOptionsBase, 'transition'> & { transitionType?: 'Slide' | 'Bounce' | 'Zoom' | 'Flip', actions?: React.ReactNode } export const getTransitionType = cond([ [equals('Slide'), always(Slide)], [equals('Bounce'), always(Bounce)], [equals('Flip'), always(Flip)], [equals('Zoom'), always(Zoom)], [T, always(Slide)] ])