Skip to content

Commit f7b688d

Browse files
authored
Merge pull request #765 from amitamrutiya/cloud-theme
Export empty state card image
2 parents 680a777 + 1149a32 commit f7b688d

File tree

10 files changed

+128
-21
lines changed

10 files changed

+128
-21
lines changed
+2-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1-
import CatalogFilterSidebar from './CatalogFilterSidebar';
1+
import CatalogFilterSidebar, { FilterList } from './CatalogFilterSidebar';
22

33
export { CatalogFilterSidebar };
4+
export type { FilterList };

src/custom/CustomCatalog/EmptyStateCard.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { FC } from 'react';
2-
import { EmptyStyleIcon } from '../../icons/EmptyStyle';
2+
import { EmptyStyleIcon } from '../../icons';
33
import { useTheme } from '../../theme';
44
import { CatalogEmptyStateDiv } from './style';
55

src/custom/CustomCatalog/style.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ export const CardBack = styled('div')<CatalogProps>(({ isCatalog }) => ({
349349
}));
350350

351351
const getBackground = (isLightMode: boolean) => {
352-
const lightGradient = `linear-gradient(to left bottom, ${WHITESMOKE}, ${GRAY97},white, white, white, white, white, white, white,white, $, ${WHITESMOKE}, ${GRAY97})`;
352+
const lightGradient = `linear-gradient(to left bottom, ${WHITESMOKE}, ${GRAY97},white, white, white, white, white, white, white, white, ${WHITESMOKE}, ${GRAY97})`;
353353
const darkGradient = `linear-gradient(to right top, ${DARK_PRIMARY_COLOR}, ${accentGrey[30]}, ${accentGrey[20]}, ${accentGrey[10]}, ${accentGrey[10]}, ${accentGrey[10]}, ${accentGrey[10]}, ${accentGrey[10]}, ${accentGrey[10]}, ${charcoal[20]}, ${charcoal[10]}, black)`;
354354

355355
return isLightMode ? lightGradient : darkGradient;

src/custom/StyledSearchBar/StyledSearchBar.tsx

+30-18
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { SxProps, Theme } from '@mui/material';
22
import { debounce } from 'lodash';
3-
import React, { useEffect, useState } from 'react';
3+
import React, { useEffect, useMemo, useState } from 'react';
44
import { InputAdornment } from '../../base';
55
import { SearchIcon } from '../../icons';
66
import { useTheme } from '../../theme';
@@ -33,44 +33,56 @@ interface SearchBarProps {
3333
*/
3434
function StyledSearchBar({
3535
onChange,
36-
value,
36+
value = '',
3737
label,
3838
sx,
3939
placeholder,
4040
endAdornment,
4141
debounceTime = 300
4242
}: SearchBarProps): JSX.Element {
4343
const theme = useTheme();
44-
const [inputValue, setInputValue] = useState(value ?? '');
44+
const [inputValue, setInputValue] = useState(value);
4545

46+
// Update local state when controlled value changes
4647
useEffect(() => {
47-
if (value !== undefined && value !== inputValue) {
48+
if (value !== inputValue) {
4849
setInputValue(value);
4950
}
5051
// eslint-disable-next-line react-hooks/exhaustive-deps
5152
}, [value]);
5253

53-
useEffect(() => {
54-
const handler = debounce((newValue: string) => {
55-
if (onChange) {
56-
const syntheticEvent = {
57-
target: { value: newValue },
58-
persist: () => {}
59-
} as React.ChangeEvent<HTMLInputElement>;
54+
// Create synthetic event helper
55+
const createSyntheticEvent = (value: string): React.ChangeEvent<HTMLInputElement> =>
56+
({
57+
target: { value },
58+
persist: () => {}
59+
}) as React.ChangeEvent<HTMLInputElement>;
6060

61-
onChange(syntheticEvent);
62-
}
63-
}, debounceTime);
61+
// Memoize the debounced handler
62+
const debouncedOnChange = useMemo(
63+
() =>
64+
debounce((newValue: string) => {
65+
onChange?.(createSyntheticEvent(newValue));
66+
}, debounceTime),
67+
[onChange, debounceTime]
68+
);
6469

65-
handler(inputValue);
70+
useEffect(() => {
71+
if (!onChange) return;
72+
if (inputValue === '') {
73+
onChange(createSyntheticEvent(inputValue));
74+
} else {
75+
debouncedOnChange(inputValue);
76+
}
6677

6778
return () => {
68-
handler.cancel();
79+
debouncedOnChange.cancel();
6980
};
70-
}, [inputValue, onChange, debounceTime]);
81+
}, [inputValue, onChange, debouncedOnChange]);
7182

7283
const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {
73-
setInputValue(event.target.value);
84+
const newValue = event.target.value;
85+
setInputValue(newValue);
7486
};
7587

7688
return (

src/custom/index.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ import { TransferListProps } from './TransferModal/TransferList/TransferList';
4545
import UniversalFilter, { UniversalFilterProps } from './UniversalFilter';
4646
export { CatalogCard } from './CatalogCard';
4747
export { CatalogFilterSidebar } from './CatalogFilterSection';
48+
export type { FilterList } from './CatalogFilterSection';
4849
export { StyledChartDialog } from './ChartDialog';
4950
export { LearningContent } from './LearningContent';
5051
export { NavigationNavbar } from './NavigationNavbar';
+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
import React from 'react';
2+
3+
interface CollapsAllIconProps {
4+
height?: string;
5+
width?: string;
6+
fill?: string;
7+
strokeWidth?: string;
8+
style?: React.CSSProperties;
9+
}
10+
11+
const CollapsAllIcon: React.FC<CollapsAllIconProps> = ({
12+
height = '24',
13+
width = '24',
14+
fill = 'none',
15+
strokeWidth = '2',
16+
style
17+
}) => (
18+
<svg
19+
xmlns="http://www.w3.org/2000/svg"
20+
viewBox="0 0 24 24"
21+
height={height}
22+
width={width}
23+
style={style}
24+
>
25+
<path
26+
d="M17 16l-5-5-5 5"
27+
fill={fill}
28+
stroke="currentColor"
29+
strokeWidth={strokeWidth}
30+
strokeLinecap="round"
31+
strokeLinejoin="round"
32+
/>
33+
<path
34+
d="M17 10l-5-5-5 5"
35+
fill={fill}
36+
stroke="currentColor"
37+
strokeWidth={strokeWidth}
38+
strokeLinecap="round"
39+
strokeLinejoin="round"
40+
/>
41+
</svg>
42+
);
43+
44+
export default CollapsAllIcon;

src/icons/CollapseAll/index.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export { default as CollapseAllIcon } from './CollapseAllIcon';

src/icons/ExpandAll/ExpandAllIcon.tsx

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
import React from 'react';
2+
3+
interface ExpandAllIconProps {
4+
height?: string;
5+
width?: string;
6+
fill?: string;
7+
strokeWidth?: string;
8+
style?: React.CSSProperties;
9+
}
10+
11+
const ExpandAllIcon: React.FC<ExpandAllIconProps> = ({
12+
height = '24',
13+
width = '24',
14+
fill = 'none',
15+
strokeWidth = '2',
16+
style
17+
}) => (
18+
<svg
19+
xmlns="http://www.w3.org/2000/svg"
20+
viewBox="0 0 24 24"
21+
height={height}
22+
width={width}
23+
style={style}
24+
>
25+
<path
26+
d="M7 8l5 5 5-5"
27+
fill={fill}
28+
stroke="currentColor"
29+
strokeWidth={strokeWidth}
30+
strokeLinecap="round"
31+
strokeLinejoin="round"
32+
/>
33+
<path
34+
d="M7 14l5 5 5-5"
35+
fill={fill}
36+
stroke="currentColor"
37+
strokeWidth={strokeWidth}
38+
strokeLinecap="round"
39+
strokeLinejoin="round"
40+
/>
41+
</svg>
42+
);
43+
44+
export default ExpandAllIcon;

src/icons/ExpandAll/index.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export { default as ExpandAllIcon } from './ExpandAllIcon';

src/icons/index.ts

+3
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ export * from './Circle';
99
export * from './Clone';
1010
export * from './Close';
1111
export * from './Cloud';
12+
export * from './CollapseAll';
1213
export * from './Column';
1314
export * from './Component';
1415
export * from './Configuration';
@@ -25,6 +26,7 @@ export * from './Designer';
2526
export * from './Detail';
2627
export * from './DropDownIcon';
2728
export * from './Error';
29+
export * from './ExpandAll';
2830
export * from './Favorite';
2931
export * from './Filter';
3032
export * from './Fullscreen';
@@ -45,6 +47,7 @@ export * from './Design';
4547
export * from './Done';
4648
export * from './Download';
4749
export * from './Edit';
50+
export * from './EmptyStyle';
4851
export * from './Environment';
4952
export * from './ExternalLink';
5053
export * from './Feedback';

0 commit comments

Comments
 (0)