Skip to content

Commit e4acb30

Browse files
committed
Minor UI fixes
1 parent e5a5260 commit e4acb30

File tree

6 files changed

+47
-78
lines changed

6 files changed

+47
-78
lines changed

src/components/FilterSelect/CustomFilterSelectComponents.js

+36-66
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
import React from 'react';
22
import styled from 'styled-components';
33
import { components } from 'react-select';
4+
import Tooltip from '../../components/Tooltip/Tooltip';
45

56
// Custom down chevron icon inside trigger
6-
const StyledDropdownIndicator = styled.div`
7+
const IconContainer = styled.div`
78
display: flex;
89
align-items: center;
910
justify-content: center;
@@ -13,13 +14,12 @@ const StyledDropdownIndicator = styled.div`
1314

1415
function DropdownIndicatorIcon(props) {
1516
return (
16-
<StyledDropdownIndicator>
17+
<IconContainer>
1718
<svg
1819
width='16'
1920
height='16'
2021
viewBox='0 0 16 16'
2122
fill='none'
22-
xmlns='http://www.w3.org/2000/svg'
2323
>
2424
<path
2525
fillRule='evenodd'
@@ -28,7 +28,35 @@ function DropdownIndicatorIcon(props) {
2828
fill='#6B6B6B'
2929
/>
3030
</svg>
31-
</StyledDropdownIndicator>
31+
</IconContainer>
32+
);
33+
}
34+
35+
function ClearIndicatorIcon(props) {
36+
const { innerProps: { ref, ...restInnerProps } } = props;
37+
return (
38+
<IconContainer ref={ref} {...restInnerProps}>
39+
<Tooltip content="Clear selections">
40+
<svg
41+
width='16'
42+
height='16'
43+
viewBox='0 0 16 16'
44+
fill='none'
45+
xmlns='http://www.w3.org/2000/svg'
46+
>
47+
<path
48+
d='M8.00001 8.70711L5.35356 11.3536L4.64645 10.6465L7.2929 8.00001L4.64645 5.35356L5.35356 4.64645L8.00001 7.2929L10.6465 4.64645L11.3536 5.35356L8.70711 8.00001L11.3536 10.6465L10.6465 11.3536L8.00001 8.70711Z'
49+
fill='#6B6B6B'
50+
/>
51+
<path
52+
fillRule='evenodd'
53+
clipRule='evenodd'
54+
d='M8 16C12.4183 16 16 12.4183 16 8C16 3.58172 12.4183 0 8 0C3.58172 0 0 3.58172 0 8C0 12.4183 3.58172 16 8 16ZM8 15C11.866 15 15 11.866 15 8C15 4.13401 11.866 1 8 1C4.13401 1 1 4.13401 1 8C1 11.866 4.13401 15 8 15Z'
55+
fill='#6B6B6B'
56+
/>
57+
</svg>
58+
</Tooltip>
59+
</IconContainer>
3260
);
3361
}
3462

@@ -51,8 +79,8 @@ const Prefix = styled.span`
5179
margin-right: 8px;
5280
background-color: ${(props) => props.theme['imdp-primary-color']};
5381
color: ${(props) => props.theme['content-color-primary']};
54-
border-top-left-radius: 3px;
55-
border-bottom-left-radius: 3px;
82+
border-top-left-radius: 2px;
83+
border-bottom-left-radius: 2px;
5684
`;
5785

5886
function CustomValueContainer(props) {
@@ -117,68 +145,10 @@ function CustomOption(props) {
117145
);
118146
}
119147

120-
// Custom menu popover - which includes "Clear" button in the bottom
121-
const StyledClearButtonContainer = styled.div`
122-
background-color: ${(props) => props.theme['background-color-primary']};
123-
padding-bottom: 4px;
124-
`;
125-
126-
const ClearSelectionButton = styled.button`
127-
width: 100%;
128-
display: inline-flex;
129-
align-items: center;
130-
justify-content: center;
131-
outline: none;
132-
border: none;
133-
border: 1px solid ${(props) => props.theme['imdp-primary-color']};
134-
border-radius: ${(props) => props.theme['border-radius-default']};
135-
height: 32px;
136-
padding: 0px 8px;
137-
margin-top: 4px;
138-
color: ${(props) => props.theme['content-color-primary']};
139-
background-color: transparent;
140-
cursor: pointer;
141-
user-select: none;
142-
143-
&:disabled {
144-
cursor: not-allowed;
145-
border: 1px solid ${(props) => props.theme['border-color-light']};
146-
color: ${(props) => props.theme['content-color-secondary']};
147-
}
148-
`;
149-
150-
const StyledMenuList = styled(components.MenuList)`
151-
padding: 8px;
152-
`;
153-
154-
function MenuList(props) {
155-
const { children = [], selectProps } = props;
156-
const {
157-
onClearSelectedOptions,
158-
value,
159-
} = selectProps;
160-
161-
const isClearButtonDisabled = !(value && value.length);
162-
return (
163-
<>
164-
<StyledMenuList {...props}>{children}</StyledMenuList>
165-
<StyledClearButtonContainer>
166-
<ClearSelectionButton
167-
onClick={onClearSelectedOptions}
168-
disabled={isClearButtonDisabled}
169-
>
170-
Cleat selected
171-
</ClearSelectionButton>
172-
</StyledClearButtonContainer>
173-
</>
174-
);
175-
}
176-
177-
178148
export {
179149
CustomValueContainer,
180150
CustomMultiValueContainer,
151+
ClearIndicatorIcon,
181152
DropdownIndicatorIcon,
182-
CustomOption,
183-
MenuList
153+
CustomOption
184154
};

src/components/FilterSelect/FilterSelect.js

+5-6
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ import Select from 'react-select';
44
import {
55
CustomValueContainer,
66
CustomMultiValueContainer,
7+
ClearIndicatorIcon,
78
DropdownIndicatorIcon,
8-
CustomOption,
9-
MenuList
9+
CustomOption
1010
} from './CustomFilterSelectComponents';
1111

1212
import {
@@ -67,19 +67,18 @@ export default function FilterSelect(props) {
6767
placeholder={placeholder}
6868
isDisabled={isDisabled}
6969
isSearchable={false}
70-
isClearable={false}
70+
isClearable={true}
7171
inlineLabel={inlineLabel}
7272
label={label}
7373
emptyStateMessage={emptyStateMessage}
7474
classNamePrefix='filter-select-dropdown'
7575
components={{
76-
ClearIndicator: null,
76+
ClearIndicator: ClearIndicatorIcon,
7777
IndicatorSeparator: null,
7878
DropdownIndicator: DropdownIndicatorIcon,
7979
MultiValue: CustomMultiValueContainer,
8080
ValueContainer: CustomValueContainer,
81-
Option: CustomOption,
82-
MenuList
81+
Option: CustomOption
8382
}}
8483
/>
8584
</FilterSelectContainer>

src/components/Tooltip/Tooltip.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ const StyledTooltip = styled(Tippy)`
77
background-color: #000000;
88
color: ${(props) => props.theme['content-color-secondary']};
99
border: 1px solid #404040;
10-
border-radius: 4px;
11-
padding: 8px;
10+
border-radius: 8px;
11+
padding: 6px;
1212
${(props) => props.theme['popover-shadow']};
1313
font-size: ${(props) => props.theme['font-size-xs']};
1414
text-align: center;

src/pages/IMDP/components/FilterByGenreDropdown.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ export default function FilterByGenreDropdown(props) {
4747
placeholder='Select genre'
4848
label='Genre'
4949
inlineLabel={inlineLabel}
50-
width='200px'
50+
width='228px'
5151
/>
5252
);
5353
}

src/pages/IMDP/components/FilterByOTTDropdown.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export default function FilterByOTTDropdown(props) {
4141
placeholder='Select platform'
4242
label='OTT'
4343
inlineLabel={inlineLabel}
44-
width='200px'
44+
width='228px'
4545
/>
4646
);
4747
}

src/pages/IMDP/styles.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ const FilterSection = styled.div`
121121
margin-top: 32px;
122122
margin-bottom: 16px;
123123
124-
@media (max-width: 840px ) {
124+
@media (max-width: 900px ) {
125125
flex-direction: column;
126126
127127
& > div {
@@ -148,7 +148,7 @@ const FilterDropdowns = styled.div`
148148
margin-right: 8px;
149149
}
150150
151-
@media (max-width: 840px ) {
151+
@media (max-width: 900px ) {
152152
flex-direction: column;
153153
align-items: center;
154154

0 commit comments

Comments
 (0)