Skip to content

Commit a3a391e

Browse files
committed
refactor: migrate the types to types file
1 parent b1fa552 commit a3a391e

File tree

3 files changed

+35
-34
lines changed

3 files changed

+35
-34
lines changed

src/Shared/Components/SelectPicker/SelectPicker.component.tsx

Lines changed: 3 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import ReactSelect, { ControlProps, MenuProps, Props as ReactSelectProps } from 'react-select'
2-
import { ReactElement, ReactNode, useCallback, useMemo } from 'react'
1+
import ReactSelect, { ControlProps, MenuProps } from 'react-select'
2+
import { useCallback, useMemo } from 'react'
33
import { ReactComponent as ErrorIcon } from '@Icons/ic-warning.svg'
44
import { ReactComponent as ICInfoFilledOverride } from '@Icons/ic-info-filled.svg'
55
import { getCommonSelectStyle } from './utils'
@@ -11,36 +11,7 @@ import {
1111
SelectPickerMenu,
1212
SelectPickerOption,
1313
} from './common'
14-
import { SelectPickerOptionType } from './type'
15-
16-
type SelectProps = ReactSelectProps<SelectPickerOptionType>
17-
18-
export interface SelectPickerProps
19-
extends Pick<
20-
SelectProps,
21-
| 'options'
22-
| 'value'
23-
| 'isMulti'
24-
| 'onChange'
25-
| 'isSearchable'
26-
| 'isClearable'
27-
| 'isLoading'
28-
| 'placeholder'
29-
| 'hideSelectedOptions'
30-
| 'controlShouldRenderValue'
31-
| 'backspaceRemovesValue'
32-
| 'closeMenuOnSelect'
33-
| 'isDisabled'
34-
| 'isLoading'
35-
| 'required'
36-
>,
37-
Required<Pick<SelectProps, 'classNamePrefix' | 'inputId'>> {
38-
icon?: ReactElement
39-
error?: ReactNode
40-
renderMenuListFooter?: () => ReactNode
41-
helperText?: ReactNode
42-
label?: ReactNode
43-
}
14+
import { SelectPickerOptionType, SelectPickerProps } from './type'
4415

4516
const SelectPicker = ({
4617
error,

src/Shared/Components/SelectPicker/common.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@ import {
99
import { Progressing } from '@Common/Progressing'
1010
import { ReactComponent as ICChevronDown } from '@Icons/ic-chevron-down.svg'
1111
import { ReactComponent as ICClose } from '@Icons/ic-close.svg'
12-
import { SelectPickerProps } from './SelectPicker.component'
13-
import { SelectPickerOptionType } from './type'
12+
import { SelectPickerOptionType, SelectPickerProps } from './type'
1413

1514
export const SelectPickerDropdownIndicator = (props: DropdownIndicatorProps) => {
1615
const { isDisabled } = props
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,39 @@
11
import { OptionType } from '@Common/Types'
22
import { ReactElement, ReactNode } from 'react'
3+
import { Props as ReactSelectProps } from 'react-select'
34

5+
// TODO Eshank: Add customization using generics
46
export interface SelectPickerOptionType extends OptionType<number | string, ReactNode> {
57
description?: string
68
startIcon?: ReactElement
79
endIcon?: ReactElement
810
}
11+
12+
type SelectProps = ReactSelectProps<SelectPickerOptionType>
13+
14+
export interface SelectPickerProps
15+
extends Pick<
16+
SelectProps,
17+
| 'options'
18+
| 'value'
19+
| 'isMulti'
20+
| 'onChange'
21+
| 'isSearchable'
22+
| 'isClearable'
23+
| 'isLoading'
24+
| 'placeholder'
25+
| 'hideSelectedOptions'
26+
| 'controlShouldRenderValue'
27+
| 'backspaceRemovesValue'
28+
| 'closeMenuOnSelect'
29+
| 'isDisabled'
30+
| 'isLoading'
31+
| 'required'
32+
>,
33+
Required<Pick<SelectProps, 'classNamePrefix' | 'inputId'>> {
34+
icon?: ReactElement
35+
error?: ReactNode
36+
renderMenuListFooter?: () => ReactNode
37+
helperText?: ReactNode
38+
label?: ReactNode
39+
}

0 commit comments

Comments
 (0)