diff --git a/packages/keychain/src/components/ErrorAlert.tsx b/packages/keychain/src/components/ErrorAlert.tsx index 9a4fcdf89..db0a5898a 100644 --- a/packages/keychain/src/components/ErrorAlert.tsx +++ b/packages/keychain/src/components/ErrorAlert.tsx @@ -1,10 +1,8 @@ import { - AlertIcon, - InfoIcon, WedgeIcon, - WarningIcon, CopyIcon, CheckIcon, + ErrorAlertIcon, } from "@cartridge/ui-next"; import { Text, @@ -21,7 +19,12 @@ import { Divider, } from "@chakra-ui/react"; import { motion } from "framer-motion"; -import React, { ReactElement, useEffect, useState } from "react"; +import React, { + ComponentProps, + ReactElement, + useEffect, + useState, +} from "react"; import { ErrorCode } from "@cartridge/account-wasm/controller"; import { ControllerError } from "@/utils/connection"; import { useConnection } from "@/hooks/connection"; @@ -70,20 +73,16 @@ export function ErrorAlert({ disabled={!description || (isExpanded && !allowToggle)} > - {(() => { - switch (variant) { - case "info": - return ; - case "warning": - return ( - - ); - case "error": - return ; - default: - return null; - } - })()} + {variant && ( + ["variant"] + } + size="xs" + /> + )} ) : ( - {(() => { - switch (variant) { - case "info": - return ; - case "warning": - return ; - case "error": - return ; - default: - return null; - } - })()} + {variant && } {value !== "FREE" && } {value} diff --git a/packages/ui-next/src/components/icons/error-alert-icon.tsx b/packages/ui-next/src/components/icons/error-alert-icon.tsx new file mode 100644 index 000000000..58dfa81f5 --- /dev/null +++ b/packages/ui-next/src/components/icons/error-alert-icon.tsx @@ -0,0 +1,36 @@ +import { cn } from "@/utils"; +import { InfoIcon, WarningIcon, AlertIcon as AlertIconRaw } from "./utility"; + +export function ErrorAlertIcon({ + variant, + size = "default", + className, +}: { + variant: "info" | "warning" | "error"; + size?: "xs" | "default"; + className?: string; +}) { + switch (variant) { + case "info": + return ( + + ); + case "warning": + return ( + + ); + case "error": + return ( + + ); + } +} diff --git a/packages/ui-next/src/components/icons/index.ts b/packages/ui-next/src/components/icons/index.ts index 93c781a76..87acaa1bf 100644 --- a/packages/ui-next/src/components/icons/index.ts +++ b/packages/ui-next/src/components/icons/index.ts @@ -2,6 +2,7 @@ export * from "./brand"; export * from "./brand-color"; export * from "./directional"; export * from "./duotone"; +export * from "./error-alert-icon"; export * from "./state"; export * from "./utility"; export * from "./types"; diff --git a/packages/ui-next/src/themes/default.css b/packages/ui-next/src/themes/default.css index f8749fc70..7e2607827 100644 --- a/packages/ui-next/src/themes/default.css +++ b/packages/ui-next/src/themes/default.css @@ -37,5 +37,12 @@ --radius: 0.5rem; --spacer: 0 0% 0%; /* solid-fills/spacer */ + + --info: 209 67% 75%; + --info-foreground: 208 100% 30%; + --warning: 209 67% 75%; + --warning-foreground: 208 100% 30%; + --error: 209 67% 75%; + --error-foreground: 208 100% 30%; } }