[DOP-3497]: Add condition for hover state

This commit is contained in:
branberry 2023-02-13 16:09:53 -06:00
parent 2d61688fcc
commit 1931d13c0c

View File

@ -129,13 +129,15 @@ export const enabledOptionStyle = css`
} }
`; `;
export const StyledLi = styled.li.attrs<{ selected: boolean; disabled?: boolean }>( export const StyledLi = styled.li.attrs<{
({ selected }) => ({ selected: boolean;
hovered?: boolean;
disabled?: boolean;
}>(({ selected }) => ({
role: 'option', role: 'option',
'aria-selected': selected, 'aria-selected': selected,
tabIndex: '0', tabIndex: '0',
}), }))<{ selected: boolean; hovered?: boolean; disabled?: boolean }>`
)<{ selected: boolean; disabled?: boolean }>`
display: flex; display: flex;
width: 100%; width: 100%;
outline: none; outline: none;
@ -147,7 +149,11 @@ export const StyledLi = styled.li.attrs<{ selected: boolean; disabled?: boolean
color: ${palette.gray.dark3}; color: ${palette.gray.dark3};
font-weight: ${props => (props.selected ? `bold` : `normal`)}; font-weight: ${props => (props.selected ? `bold` : `normal`)};
${props =>
props.hovered &&
`
color: #083C90;
backgroundColor: #E1F7FF
&:before { &:before {
content: ''; content: '';
position: absolute; position: absolute;
@ -160,7 +166,7 @@ export const StyledLi = styled.li.attrs<{ selected: boolean; disabled?: boolean
border-radius: 0px 4px 4px 0px; border-radius: 0px 4px 4px 0px;
opacity: 0; opacity: 0;
transition: all ${transitionDuration.default}ms ease-in-out; transition: all ${transitionDuration.default}ms ease-in-out;
} }`}
${props => (props.disabled ? disabledOptionStyle : enabledOptionStyle)} ${props => (props.disabled ? disabledOptionStyle : enabledOptionStyle)}
`; `;