Skip to content

Commit

Permalink
Define a color scheme - error
Browse files Browse the repository at this point in the history
  • Loading branch information
kkosiorowska committed Dec 13, 2023
1 parent 442c891 commit e09ce8d
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 16 deletions.
6 changes: 2 additions & 4 deletions dapp/src/components/Header/ConnectWallet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,12 @@ function ConnectButton({
account,
requestAccount,
}: ConnectButtonsProps) {
const styles = !account
? { color: "red.400", borderColor: "red.400", bg: "transparent" }
: undefined
const colorScheme = !account ? "error" : undefined

return (
<Button
variant="card"
sx={styles}
colorScheme={colorScheme}
leftIcon={<Icon as={leftIcon} boxSize={6} />}
onClick={requestAccount}
>
Expand Down
32 changes: 20 additions & 12 deletions dapp/src/theme/Button.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ComponentSingleStyleConfig } from "@chakra-ui/react"
import { ComponentSingleStyleConfig, StyleFunctionProps } from "@chakra-ui/react"

Check failure on line 1 in dapp/src/theme/Button.ts

View workflow job for this annotation

GitHub Actions / dapp-format

Replace `·ComponentSingleStyleConfig,·StyleFunctionProps·` with `⏎··ComponentSingleStyleConfig,⏎··StyleFunctionProps,⏎`

// TODO: Update the button styles correctly when ready
const Button: ComponentSingleStyleConfig = {
Expand Down Expand Up @@ -37,17 +37,25 @@ const Button: ComponentSingleStyleConfig = {
bg: "transparent",
},
},
card: {
borderWidth: "2px",
borderColor: "gold.100",
borderRadius: "xl",
bg: "gold.200",
_hover: {
bg: "opacity.grey.700-05",
},
_active: {
bg: "transparent",
},
card: (props: StyleFunctionProps) => {
const defaultStyles = {
borderWidth: "2px",

Check failure on line 42 in dapp/src/theme/Button.ts

View workflow job for this annotation

GitHub Actions / dapp-format

Delete `··`
borderColor: "gold.100",

Check failure on line 43 in dapp/src/theme/Button.ts

View workflow job for this annotation

GitHub Actions / dapp-format

Delete `··`
borderRadius: "xl",

Check failure on line 44 in dapp/src/theme/Button.ts

View workflow job for this annotation

GitHub Actions / dapp-format

Replace `··········` with `········`
bg: "gold.200",

Check failure on line 45 in dapp/src/theme/Button.ts

View workflow job for this annotation

GitHub Actions / dapp-format

Delete `··`
_hover: {

Check failure on line 46 in dapp/src/theme/Button.ts

View workflow job for this annotation

GitHub Actions / dapp-format

Replace `··········` with `········`
bg: "opacity.grey.700-05",

Check failure on line 47 in dapp/src/theme/Button.ts

View workflow job for this annotation

GitHub Actions / dapp-format

Delete `··`
},

Check failure on line 48 in dapp/src/theme/Button.ts

View workflow job for this annotation

GitHub Actions / dapp-format

Delete `··`
_active: {

Check failure on line 49 in dapp/src/theme/Button.ts

View workflow job for this annotation

GitHub Actions / dapp-format

Delete `··`
bg: "transparent",

Check failure on line 50 in dapp/src/theme/Button.ts

View workflow job for this annotation

GitHub Actions / dapp-format

Delete `··`
},
}

if(props.colorScheme === "error") {
return {...defaultStyles, color: "red.400", borderColor: "red.400", bg: "transparent" }
}

return defaultStyles
},
},
}
Expand Down

0 comments on commit e09ce8d

Please sign in to comment.