Skip to content

Commit 616ffb9

Browse files
committed
select multi value container & dropdown indicator added
1 parent ab22a88 commit 616ffb9

File tree

4 files changed

+41
-4
lines changed

4 files changed

+41
-4
lines changed

src/Common/Hooks/useStateFilters/types.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,14 @@ export interface UseStateFiltersProps<T> extends Pick<UseUrlFiltersProps<T, neve
2121
export interface UseStateFiltersReturnType<T>
2222
extends Pick<
2323
UseUrlFiltersReturnType<T>,
24-
'sortBy' | 'sortOrder' | 'handleSorting' | 'clearFilters' | 'changePage' | 'changePageSize'
24+
| 'sortBy'
25+
| 'sortOrder'
26+
| 'handleSorting'
27+
| 'clearFilters'
28+
| 'changePage'
29+
| 'changePageSize'
30+
| 'offset'
31+
| 'pageSize'
2532
> {
2633
/*
2734
* Handler for resetting the pagination to the initial state
@@ -32,5 +39,4 @@ export interface UseStateFiltersReturnType<T>
3239
export interface PaginationType {
3340
pageSize: number
3441
offset: number
35-
size: number
3642
}

src/Common/Hooks/useStateFilters/useStateFilters.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ const useStateFilters = <T = string,>({
4343
const [pagination, setPagination] = useState<PaginationType>({
4444
pageSize: DEFAULT_BASE_PAGE_SIZE,
4545
offset: 0,
46-
size: 0,
4746
})
4847

4948
const changePage = (pageNo: number): void => {
@@ -89,7 +88,6 @@ const useStateFilters = <T = string,>({
8988
setPagination({
9089
pageSize: DEFAULT_BASE_PAGE_SIZE,
9190
offset: 0,
92-
size: 0,
9391
})
9492
}
9593

src/Common/MultiSelectCustomization.tsx

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,10 @@ export const SingleSelectOption = (props) => {
6161
)
6262
}
6363

64+
/**
65+
* Multi value container
66+
*/
67+
6468
export const MultiValueContainer = (props) => {
6569
const { children, data, innerProps, selectProps } = props
6670
const { label, value } = data
@@ -71,6 +75,28 @@ export const MultiValueContainer = (props) => {
7175
</components.MultiValueContainer>
7276
)
7377
}
78+
/**
79+
*
80+
* Multi value container with count
81+
*/
82+
export const MultiValueContainerWithCount = (props: any) => {
83+
const { children, data, innerProps, selectProps } = props
84+
const selectedLen = selectProps.value?.length ?? 0
85+
86+
return (
87+
<components.MultiValueContainer {...{ data, innerProps, selectProps }}>
88+
{(!selectProps.menuIsOpen || !selectProps.inputValue) && (
89+
<span className="cn-9 fs-13 lh-20">
90+
{selectProps.placeholder}
91+
{selectedLen > 0 && (
92+
<span className="bcb-5 cn-0 fw-6 fs-12 br-8 ml-4 pr-8 pl-8">{selectedLen}</span>
93+
)}
94+
</span>
95+
)}
96+
{children[1]}
97+
</components.MultiValueContainer>
98+
)
99+
}
74100

75101
export const ClearIndicator = (props) => {
76102
const {

src/Shared/Components/ReactSelect/utils.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
import Tippy from '@tippyjs/react'
1818
import { components } from 'react-select'
1919
import { Progressing, stopPropagation } from '../../../Common'
20+
import { ReactComponent as ICCaretDown } from '../../../Assets/Icon/ic-chevron-down.svg'
2021

2122
export const getCommonSelectStyle = (styleOverrides = {}) => ({
2223
container: (base, state) => ({
@@ -165,4 +166,10 @@ export const GroupHeading = (props: any) => {
165166
)
166167
}
167168

169+
export const DropdownIndicator = (props) => (
170+
<components.DropdownIndicator {...props}>
171+
<ICCaretDown className="icon-dim-20 icon-n5" data-testId />
172+
</components.DropdownIndicator>
173+
)
174+
168175
export const commonSelectStyles = getCommonSelectStyle()

0 commit comments

Comments
 (0)