Skip to content

Commit

Permalink
Add highlight feature without error message
Browse files Browse the repository at this point in the history
  • Loading branch information
vineethasok committed Sep 28, 2023
1 parent 7b2e58f commit 696f987
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
9 changes: 4 additions & 5 deletions src/components/Input/InputWrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,27 +77,26 @@ export interface WrapperProps {
export const InputWrapper = ({
id,
label = "",
error = "",
error,
disabled,
children,
orientation,
dir,
}: WrapperProps) => {
const showError = error ? typeof error === "string" && error.length !== 0 : false;
return (
<FormRoot
$orientation={orientation}
$dir={dir}
>
<FormElementContainer>
<Wrapper $error={showError}>{children}</Wrapper>
{showError && <Error>{error}</Error>}
<Wrapper $error={!!error}>{children}</Wrapper>
{!!error && error !== true && <Error>{error}</Error>}
</FormElementContainer>
{label && (
<Label
htmlFor={id}
disabled={disabled}
error={showError}
error={!!error}
>
{label}
</Label>
Expand Down
2 changes: 1 addition & 1 deletion src/components/Select/common/InternalSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ export const InternalSelect = ({
</SelectPopoverContent>
</Portal>
</SelectPopoverRoot>
{!!error && <Error>{error}</Error>}
{!!error && error !== true && <Error>{error}</Error>}
</FormElementContainer>
{label && (
<Label
Expand Down

0 comments on commit 696f987

Please sign in to comment.