Skip to content

Commit

Permalink
Fix alert colors issue
Browse files Browse the repository at this point in the history
  • Loading branch information
kpyszkowski committed Dec 10, 2024
1 parent 5438ba8 commit 8f4faff
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
19 changes: 13 additions & 6 deletions dapp/src/components/ConnectWalletModal/ConnectWalletAlert.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ type ConnectionAlerts = Record<
title: string
description?: React.ReactNode
status?: AlertStatus
colorScheme?: string
}
>

Expand All @@ -49,6 +50,7 @@ const CONNECTION_ALERTS: ConnectionAlerts = {
[ConnectionAlert.Rejected]: {
title: "Please connect your wallet to start using Acre",
status: "info",
colorScheme: "blue",
},
[ConnectionAlert.NotSupported]: {
title: "Not supported.",
Expand Down Expand Up @@ -82,11 +84,16 @@ type ConnectWalletAlertProps = Omit<AlertProps, "status"> & {
export default function ConnectWalletAlert(props: ConnectWalletAlertProps) {
const { type, ...restProps } = props

const data = type ? CONNECTION_ALERTS[type] : undefined
const {
status = "error",
title,

Check failure on line 89 in dapp/src/components/ConnectWalletModal/ConnectWalletAlert.tsx

View workflow job for this annotation

GitHub Actions / dapp-format

Unsafe array destructuring of a tuple element with an `any` value
description,

Check failure on line 90 in dapp/src/components/ConnectWalletModal/ConnectWalletAlert.tsx

View workflow job for this annotation

GitHub Actions / dapp-format

Unsafe array destructuring of a tuple element with an `any` value
...restData
} = type ? CONNECTION_ALERTS[type] : {}

return (
<AnimatePresence initial={false}>
{data && (
{type && (
<Box
as={motion.div}
variants={collapseVariants}
Expand All @@ -96,12 +103,12 @@ export default function ConnectWalletAlert(props: ConnectWalletAlertProps) {
overflow="hidden"
w="full"
>
<Alert status={data.status || "error"} mb={6} {...restProps}>
<Alert status={status} mb={6} {...restProps} {...restData}>
<AlertIcon />
<VStack w="full" align="start" spacing={0}>
<AlertTitle textAlign="start">{data.title}</AlertTitle>
{data.description && (
<AlertDescription>{data.description}</AlertDescription>
<AlertTitle textAlign="start">{title}</AlertTitle>
{description && (
<AlertDescription>{description}</AlertDescription>
)}
</VStack>
</Alert>
Expand Down
2 changes: 1 addition & 1 deletion dapp/src/components/shared/Alert.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import Spinner from "./Spinner"
const STATUSES = {
info: {
icon: IconInfoCircle,
colorScheme: "blue",
colorScheme: "gold",
},
warning: {
icon: IconExclamationCircle,
Expand Down

0 comments on commit 8f4faff

Please sign in to comment.