diff options
author | Nikita Tchayka <nikitatchayka@gmail.com> | 2023-08-29 23:31:42 +0100 |
---|---|---|
committer | Nikita Tchayka <nikitatchayka@gmail.com> | 2023-08-29 23:31:42 +0100 |
commit | 18be2308873c50936c08d254ebb20afe1bdc318a (patch) | |
tree | 91b2303f1f4cd9a114f28d08fd374f7f7e338063 /src/components/Dialog.tsx | |
parent | c42528a68d0a13fd7b8d9e3448def4db35ef6096 (diff) | |
download | neohaskell.github.io-18be2308873c50936c08d254ebb20afe1bdc318a.tar.gz neohaskell.github.io-18be2308873c50936c08d254ebb20afe1bdc318a.tar.bz2 neohaskell.github.io-18be2308873c50936c08d254ebb20afe1bdc318a.zip |
Update
Diffstat (limited to 'src/components/Dialog.tsx')
-rw-r--r-- | src/components/Dialog.tsx | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/src/components/Dialog.tsx b/src/components/Dialog.tsx new file mode 100644 index 0000000..0258e88 --- /dev/null +++ b/src/components/Dialog.tsx @@ -0,0 +1,56 @@ +import React from "react"; +import Button from "./Button"; +import classNames from "classnames"; + +type DialogType = { + message: string; + width?: "fit" | "full" | "1/2" | "1/3"; + cancelButtonText?: string; + actionButtonText?: string; + actionButtonColor?: + | "violet" + | "pink" + | "red" + | "orange" + | "yellow" + | "lime" + | "cyan"; +}; + +const Dialog = ({ + message, + width, + cancelButtonText, + actionButtonText, + actionButtonColor, +}: DialogType) => { + return ( + <div + className={classNames( + "px-8 py-4 dark:bg-slate-850 bg-white border-4 border-black shadow-[8px_8px_0px_rgba(0,0,0,1)] grid place-content-center", + { "w-fit": width === "fit" }, + { "w-full": width === "full" }, + { "w-1/2": width === "1/2" }, + { "w-1/3": width === "1/3" } + )} + > + <div> + <h1 className="text-2xl mb-4">{message}</h1> + <div className="flex space-x-2 mx-auto"> + {cancelButtonText && ( + <button className="text-base">{cancelButtonText}</button> + )} + {actionButtonText && ( + <Button + buttonText={actionButtonText} + rounded="full" + color={actionButtonColor && actionButtonColor} + /> + )} + </div> + </div> + </div> + ); +}; + +export default Dialog; |