Last active
October 12, 2023 18:28
-
-
Save nireno/b5fa202863293ff9905b8b6bd9dfe1a6 to your computer and use it in GitHub Desktop.
Rescript-ReactHotToast
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
module Toaster = { | |
@react.component @module("react-hot-toast") | |
external make: ( | |
~position: option<string>=?, | |
~reverseOrder: option<bool>=?, | |
~gutter: option<int>=?, | |
~containerClassName: option<string>=?, | |
~containerStyle: option<ReactDOMRe.Style.t>=?, | |
~toastOptions: option<{..}>=?, | |
) => React.element = "Toaster" | |
} | |
type toast = string => unit | |
type toastId | |
@module("react-hot-toast") @val | |
external toast: toast = "default" | |
@send | |
external success: (toast, string) => unit = "success" | |
let success = toast->success | |
@send | |
external error: (toast, string) => unit = "error" | |
let error = toast->error | |
@send | |
external loading: (toast, string) => toastId = "loading" | |
let loading = toast->loading | |
@send | |
external dismiss: (toast, toastId) => unit = "dismiss" | |
let dismiss = toast->dismiss |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment