Skip to content

Commit 64bd255

Browse files
committed
data test id props in search bar
1 parent 76ddfe7 commit 64bd255

File tree

6 files changed

+104
-4
lines changed

6 files changed

+104
-4
lines changed

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@devtron-labs/devtron-fe-common-lib",
3-
"version": "0.0.83-beta-2",
3+
"version": "0.0.83-beta-5",
44
"description": "Supporting common component library",
55
"type": "module",
66
"main": "dist/index.js",

src/Common/SearchBar/SearchBar.component.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ const SearchBar = ({
4747
containerClassName,
4848
shouldDebounce = false,
4949
debounceTimeout = 300,
50+
dataTestId = 'search-bar',
5051
}: SearchBarProps) => {
5152
const [showClearButton, setShowClearButton] = useState(!!initialSearchText)
5253
const inputRef = useRef<HTMLInputElement>()
@@ -101,7 +102,7 @@ const SearchBar = ({
101102
<Search className="search-bar__icon dc__position-abs icon-color-n6 icon-dim-16" />
102103
<input
103104
placeholder="Search"
104-
data-testid="search-bar"
105+
data-testid={dataTestId}
105106
type="text"
106107
{...inputProps}
107108
defaultValue={initialSearchText}

src/Common/SearchBar/types.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,8 @@ export interface SearchBarProps {
3131
* Timeout for the debounce handler to be triggered
3232
*/
3333
debounceTimeout?: number
34+
/**
35+
* Data test id for the search input
36+
*/
37+
dataTestId?: string
3438
}
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
export const CommonGroupedDropdownStyles = {
2+
container: (base, state) => ({
3+
...base,
4+
...(state.isDisabled && {
5+
cursor: 'not-allowed',
6+
pointerEvents: 'auto',
7+
}),
8+
minHeight: '36px',
9+
width: '100%',
10+
}),
11+
control: (base, state) => ({
12+
...base,
13+
boxShadow: 'none',
14+
minHeight: '36px',
15+
backgroundColor: 'var(--N50)',
16+
cursor: state.isDisabled ? 'not-allowed' : 'pointer',
17+
opacity: state.isDisabled ? 0.5 : 1,
18+
maxHeight: '200px',
19+
overflow: 'scroll',
20+
alignItems: 'flex-start',
21+
}),
22+
singleValue: (base) => ({
23+
...base,
24+
fontWeight: 400,
25+
color: 'var(--N900)',
26+
fontSize: '13px',
27+
}),
28+
option: (base, state) => ({
29+
...base,
30+
padding: '6px 8px 6px 0',
31+
backgroundColor: state.isFocused ? 'var(--N100)' : 'white',
32+
color: 'var(--N900)',
33+
cursor: 'pointer',
34+
overflow: 'hidden',
35+
textOverflow: 'ellipsis',
36+
whiteSpace: 'nowrap',
37+
fontSize: '13px',
38+
}),
39+
valueContainer: (base) => ({
40+
...base,
41+
padding: '4px 0px 4px 8px',
42+
display: 'flex',
43+
minHeight: '36px',
44+
gap: '6px',
45+
}),
46+
dropdownIndicator: (base, state) => ({
47+
...base,
48+
transition: 'all .2s ease',
49+
transform: state.selectProps.menuIsOpen ? 'rotate(180deg)' : 'rotate(0deg)',
50+
...(state.isDisabled ? { opacity: state.isDisabled ? 0.7 : 1 } : {}),
51+
}),
52+
group: (base) => ({
53+
...base,
54+
paddingTop: '4px',
55+
paddingBottom: 0,
56+
}),
57+
groupHeading: (base) => ({
58+
...base,
59+
fontWeight: 600,
60+
fontSize: '12px',
61+
color: 'var(--N900)',
62+
backgroundColor: 'var(--N100)',
63+
marginBottom: 0,
64+
padding: '4px 8px',
65+
textTransform: 'none',
66+
overflow: 'hidden',
67+
textOverflow: 'ellipsis',
68+
whiteSpace: 'nowrap',
69+
}),
70+
menuList: (base) => ({
71+
...base,
72+
padding: 0,
73+
marginBottom: '4px',
74+
}),
75+
multiValue: (base) => ({
76+
...base,
77+
border: `1px solid var(--N200)`,
78+
borderRadius: `4px`,
79+
background: 'white',
80+
height: '28px',
81+
margin: '0px',
82+
padding: '2px',
83+
fontSize: '13px',
84+
}),
85+
multiValueLabel: (base) => ({
86+
...base,
87+
padding: '0px',
88+
fontSize: '13px',
89+
}),
90+
placeholder: (base) => ({
91+
...base,
92+
position: 'absolute',
93+
}),
94+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
export * from './utils'
2+
export * from './constants'

0 commit comments

Comments
 (0)