From 4783a664a780a9e2e19b7c10ad2fdfb74e61b52d Mon Sep 17 00:00:00 2001 From: Justin Edmund Date: Sat, 3 Dec 2022 16:39:58 -0800 Subject: [PATCH] Add custom Alert component --- components/Alert/index.scss | 52 +++++++++++++++++++++++++++++++++++++ components/Alert/index.tsx | 51 ++++++++++++++++++++++++++++++++++++ 2 files changed, 103 insertions(+) create mode 100644 components/Alert/index.scss create mode 100644 components/Alert/index.tsx diff --git a/components/Alert/index.scss b/components/Alert/index.scss new file mode 100644 index 00000000..fe2e0df9 --- /dev/null +++ b/components/Alert/index.scss @@ -0,0 +1,52 @@ +.AlertWrapper { + align-items: center; + display: flex; + justify-content: center; + position: absolute; + height: 100vh; + width: 100vw; + top: 0; + left: 0; + z-index: 21; +} + +.Alert { + background: white; + border-radius: $unit; + display: flex; + flex-direction: column; + gap: $unit; + min-width: $unit * 20; + max-width: $unit * 40; + padding: $unit * 4; + + .description { + font-size: $font-regular; + line-height: 1.26; + } + + .buttons { + align-self: flex-end; + } + + .Button { + font-size: $font-regular; + padding: ($unit * 1.5) ($unit * 2); + margin-top: $unit * 2; + + &.btn-disabled { + background: $grey-90; + color: $grey-70; + cursor: not-allowed; + } + + &:not(.btn-disabled) { + background: $grey-90; + color: $grey-40; + + &:hover { + background: $grey-80; + } + } + } +} diff --git a/components/Alert/index.tsx b/components/Alert/index.tsx new file mode 100644 index 00000000..8e785c70 --- /dev/null +++ b/components/Alert/index.tsx @@ -0,0 +1,51 @@ +import React from "react" +import * as AlertDialog from "@radix-ui/react-alert-dialog" + +import "./index.scss" +import Button from "~components/Button" +import { ButtonType } from "~utils/enums" + +// Props +interface Props { + open: boolean + title?: string + message: string + primaryAction?: () => void + primaryActionText?: string + cancelAction: () => void + cancelActionText: string +} + +const Alert = (props: Props) => { + return ( + + + +
+ + {props.title ? Error : ""} + + {props.message} + +
+ + + + {props.primaryAction ? ( + + {props.primaryActionText} + + ) : ( + "" + )} +
+
+
+
+
+ ) +} + +export default Alert