Skip to content

Commit

Permalink
Add styles when input is invalid
Browse files Browse the repository at this point in the history
  • Loading branch information
kkosiorowska committed Dec 19, 2023
1 parent a26798b commit bacd2ce
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
3 changes: 2 additions & 1 deletion dapp/src/components/shared/NumberFormatInput/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const NumberFormatInput = React.forwardRef<
>((props, ref) => {
const { field: css } = useMultiStyleConfig("Input", props)

const { decimalScale, isDisabled, ...restProps } = props
const { decimalScale, isDisabled, isInvalid, ...restProps } = props

return (
<ChakraWrapper
Expand All @@ -38,6 +38,7 @@ const NumberFormatInput = React.forwardRef<
decimalScale={decimalScale}
__css={css}
disabled={isDisabled}
aria-invalid={isInvalid}
getInputRef={ref}
{...restProps}
/>
Expand Down
1 change: 1 addition & 0 deletions dapp/src/components/shared/TokenBalanceInput/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ export default function TokenBalanceInput({
size={size}
value={amount}
variant={VARIANT}
isInvalid={hasError}
placeholder={placeholder}
onValueChange={(values: NumberFormatInputValues) =>
setAmount(values.value)
Expand Down
4 changes: 4 additions & 0 deletions dapp/src/theme/Input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ const variantBalanceField = defineStyle({
color: "grey.300",
fontWeight: "medium",
},

_invalid: {
color: "red.400",
},
})

const variantBalanceElement = defineStyle({
Expand Down

0 comments on commit bacd2ce

Please sign in to comment.