-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #143 from osstotalsoft/actionsOnToast
Optimizations on Toast Component. Refactor toast with our own icons. Added actions for passing ReactNode code to the footer of the toast.
- Loading branch information
Showing
16 changed files
with
652 additions
and
164 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -45,7 +45,6 @@ const preview: Preview = { | |
}, | ||
decorators: [withThemeProvider], | ||
tags: ['autodocs'] | ||
|
||
} | ||
|
||
export default preview |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
export * from './types' | ||
export { default as ToastContainer } from './ToastContainer' | ||
export { default as useToast } from './useToast' | ||
export { default as usePromiseToast } from './usePromiseToast' | ||
export { default as usePromiseToast } from './usePromiseToast' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,32 @@ | ||
// Copyright (c) TotalSoft. | ||
// This source code is licensed under the MIT license. | ||
import { ToastContainerProps as ReactToastifyProps } from 'react-toastify' | ||
import { always, cond, equals, T } from 'ramda' | ||
import { Bounce, Flip, ToastOptions as ToastOptionsBase, ToastContainerProps as ToastContainerPropsBase, Slide, Zoom } from 'react-toastify' | ||
|
||
export interface ToastContainerProps extends Omit<ReactToastifyProps, 'transition'> { | ||
export type TextFontSize = 'small' | 'medium' | 'large' | ||
|
||
export interface ToastContainerProps extends Omit<ToastContainerPropsBase, 'transition' | 'textSize'> { | ||
/** | ||
* The appearance effect. | ||
* @default Slide | ||
*/ | ||
transitionType?: 'Slide' | 'Bounce' | 'Zoom' | 'Flip' | ||
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)] | ||
]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.