Skip to content

Commit

Permalink
fix(SearchBar): fix clear button color on hover
Browse files Browse the repository at this point in the history
Ref NOTICKET
  • Loading branch information
ajkl2533 committed Nov 27, 2024
1 parent 83b84eb commit 286ab6d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 12 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
27 changes: 15 additions & 12 deletions src/components/forms/SearchBar/SearchBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,10 @@ import {
isNotNilOrEmpty,
isNotUndefined,
} from 'ramda-adjunct';
import { pipe } from 'ramda';
import cls from 'classnames';

import { getColor, getFormStyle, getSpace, pxToRem } from '../../../utils';
import { getFormStyle } from '../../../utils';
import { Input } from '../Input';
import { SpaceSizes } from '../../../theme';
import { Icon } from '../../Icon';
import { IconTypes, SSCIconNames } from '../../../theme/icons/icons.enums';
import { Spinner } from '../../Spinner';
Expand All @@ -34,26 +32,31 @@ const IconWrapper = styled.div`
top: 0;
display: flex;
align-items: center;
color: ${getColor('neutral.800')};
color: var(--sscds-color-icon-subtle);
`;

const SearchIconWrapper = styled(IconWrapper)`
left: 0;
padding-inline: ${getSpace(SpaceSizes.md)};
padding-inline: var(--sscds-space-4x);
height: 100%;
`;

const ClearButton = styled(IconWrapper)`
right: ${getSpace(SpaceSizes.md)};
height: ${pipe(getFormStyle('fieldHeight'), pxToRem)};
display: grid;
place-items: center;
right: 0;
height: ${getFormStyle('fieldHeight')};
width: ${getFormStyle('fieldHeight')};
background: none;
border: none;
border-radius: 0;
cursor: pointer;
&:hover,
&:focus {
::after {
color: var(--sscds-color-icon-inverse);
&::after {
content: '';
position: absolute;
top: 50%;
Expand All @@ -62,17 +65,17 @@ const ClearButton = styled(IconWrapper)`
width: 24px;
height: 24px;
border-radius: 100%;
background-color: ${getColor('error.500')};
background-color: var(--sscds-color-background-action-danger-hover);
z-index: -1;
}
}
`;

const SearchInput = styled(Input)`
padding-left: ${getSpace(SpaceSizes.lgPlus)};
padding-left: var(--sscds-space-12x);
padding-right: ${({ $isClearable, theme }) =>
getSpace($isClearable ? SpaceSizes.lgPlus : SpaceSizes.md, { theme })};
padding-right: ${({ $isClearable }) =>
$isClearable ? 'var(--sscds-space-12x)' : 'var(--sscds-space-4x)'};
`;

const SearchBar = forwardRef<HTMLInputElement, SearchBarProps>(
Expand Down

0 comments on commit 286ab6d

Please sign in to comment.