fixing dropdown arrow behavior for Topics Messages (#2028)

* fixing dropdown arrow behavior

* adding color from theme
This commit is contained in:
Robert Azizbekyan 2022-05-30 11:46:32 +04:00 committed by GitHub
parent cf6454c987
commit b32ff9ca8b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 29 additions and 7 deletions

View file

@ -0,0 +1,26 @@
import React from 'react';
import { useTheme } from 'styled-components';
interface Props {
isOpen: boolean;
}
const DropdownArrowIcon: React.FC<Props> = ({ isOpen }) => {
const theme = useTheme();
return (
<svg
width="24"
height="24"
fill="none"
stroke="currentColor"
strokeWidth="2"
color={theme.icons.dropdownArrowIcon}
transform={isOpen ? 'rotate(180)' : ''}
>
<path d="M6 9L12 15 18 9" />
</svg>
);
};
export default DropdownArrowIcon;

View file

@ -32,13 +32,6 @@ export const Select = styled.ul<Props>`
color: ${({ theme, disabled }) => color: ${({ theme, disabled }) =>
disabled ? theme.select.color.disabled : theme.select.color.normal}; disabled ? theme.select.color.disabled : theme.select.color.normal};
min-width: ${({ minWidth }) => minWidth || 'auto'}; min-width: ${({ minWidth }) => minWidth || 'auto'};
background-image: ${({ disabled }) =>
`url('data:image/svg+xml,%3Csvg width="10" height="6" viewBox="0 0 10 6" fill="none" xmlns="http://www.w3.org/2000/svg"%3E%3Cpath d="M1 1L5 5L9 1" stroke="${
disabled ? '%23ABB5BA' : '%23454F54'
}"/%3E%3C/svg%3E%0A') !important`};
background-repeat: no-repeat !important;
background-position-x: calc(100% - 8px) !important;
background-position-y: 55% !important;
cursor: ${({ disabled }) => (disabled ? 'not-allowed' : 'pointer')}; cursor: ${({ disabled }) => (disabled ? 'not-allowed' : 'pointer')};
&:hover:enabled { &:hover:enabled {
color: ${(props) => props.theme.select.color.hover}; color: ${(props) => props.theme.select.color.hover};

View file

@ -1,5 +1,6 @@
import React, { useState, useRef } from 'react'; import React, { useState, useRef } from 'react';
import useClickOutside from 'lib/hooks/useClickOutside'; import useClickOutside from 'lib/hooks/useClickOutside';
import DropdownArrowIcon from 'components/common/Icons/DropdownArrowIcon';
import * as S from './Select.styled'; import * as S from './Select.styled';
import LiveIcon from './LiveIcon.styled'; import LiveIcon from './LiveIcon.styled';
@ -97,6 +98,7 @@ const Select: React.FC<SelectProps> = ({
))} ))}
</S.OptionList> </S.OptionList>
)} )}
<DropdownArrowIcon isOpen={showOptions} />
</S.Select> </S.Select>
</div> </div>
); );

View file

@ -490,6 +490,7 @@ const theme = {
newFilterIcon: Colors.brand[50], newFilterIcon: Colors.brand[50],
closeModalIcon: Colors.neutral[25], closeModalIcon: Colors.neutral[25],
savedIcon: Colors.brand[50], savedIcon: Colors.brand[50],
dropdownArrowIcon: Colors.neutral[30],
}, },
viewer: { viewer: {
wrapper: Colors.neutral[3], wrapper: Colors.neutral[3],