Skip to content

Commit

Permalink
Merge pull request #765 from amitamrutiya/cloud-theme
Browse files Browse the repository at this point in the history
Export empty state card image
  • Loading branch information
amitamrutiya authored Oct 21, 2024
2 parents 680a777 + 1149a32 commit f7b688d
Show file tree
Hide file tree
Showing 10 changed files with 128 additions and 21 deletions.
3 changes: 2 additions & 1 deletion src/custom/CatalogFilterSection/index.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import CatalogFilterSidebar from './CatalogFilterSidebar';
import CatalogFilterSidebar, { FilterList } from './CatalogFilterSidebar';

export { CatalogFilterSidebar };
export type { FilterList };
2 changes: 1 addition & 1 deletion src/custom/CustomCatalog/EmptyStateCard.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { FC } from 'react';
import { EmptyStyleIcon } from '../../icons/EmptyStyle';
import { EmptyStyleIcon } from '../../icons';
import { useTheme } from '../../theme';
import { CatalogEmptyStateDiv } from './style';

Expand Down
2 changes: 1 addition & 1 deletion src/custom/CustomCatalog/style.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ export const CardBack = styled('div')<CatalogProps>(({ isCatalog }) => ({
}));

const getBackground = (isLightMode: boolean) => {
const lightGradient = `linear-gradient(to left bottom, ${WHITESMOKE}, ${GRAY97},white, white, white, white, white, white, white,white, $, ${WHITESMOKE}, ${GRAY97})`;
const lightGradient = `linear-gradient(to left bottom, ${WHITESMOKE}, ${GRAY97},white, white, white, white, white, white, white, white, ${WHITESMOKE}, ${GRAY97})`;
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)`;

return isLightMode ? lightGradient : darkGradient;
Expand Down
48 changes: 30 additions & 18 deletions src/custom/StyledSearchBar/StyledSearchBar.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { SxProps, Theme } from '@mui/material';
import { debounce } from 'lodash';
import React, { useEffect, useState } from 'react';
import React, { useEffect, useMemo, useState } from 'react';
import { InputAdornment } from '../../base';
import { SearchIcon } from '../../icons';
import { useTheme } from '../../theme';
Expand Down Expand Up @@ -33,44 +33,56 @@ interface SearchBarProps {
*/
function StyledSearchBar({
onChange,
value,
value = '',
label,
sx,
placeholder,
endAdornment,
debounceTime = 300
}: SearchBarProps): JSX.Element {
const theme = useTheme();
const [inputValue, setInputValue] = useState(value ?? '');
const [inputValue, setInputValue] = useState(value);

// Update local state when controlled value changes
useEffect(() => {
if (value !== undefined && value !== inputValue) {
if (value !== inputValue) {
setInputValue(value);
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [value]);

useEffect(() => {
const handler = debounce((newValue: string) => {
if (onChange) {
const syntheticEvent = {
target: { value: newValue },
persist: () => {}
} as React.ChangeEvent<HTMLInputElement>;
// Create synthetic event helper
const createSyntheticEvent = (value: string): React.ChangeEvent<HTMLInputElement> =>
({
target: { value },
persist: () => {}
}) as React.ChangeEvent<HTMLInputElement>;

onChange(syntheticEvent);
}
}, debounceTime);
// Memoize the debounced handler
const debouncedOnChange = useMemo(
() =>
debounce((newValue: string) => {
onChange?.(createSyntheticEvent(newValue));
}, debounceTime),
[onChange, debounceTime]
);

handler(inputValue);
useEffect(() => {
if (!onChange) return;
if (inputValue === '') {
onChange(createSyntheticEvent(inputValue));
} else {
debouncedOnChange(inputValue);
}

return () => {
handler.cancel();
debouncedOnChange.cancel();
};
}, [inputValue, onChange, debounceTime]);
}, [inputValue, onChange, debouncedOnChange]);

const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {
setInputValue(event.target.value);
const newValue = event.target.value;
setInputValue(newValue);
};

return (
Expand Down
1 change: 1 addition & 0 deletions src/custom/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ import { TransferListProps } from './TransferModal/TransferList/TransferList';
import UniversalFilter, { UniversalFilterProps } from './UniversalFilter';
export { CatalogCard } from './CatalogCard';
export { CatalogFilterSidebar } from './CatalogFilterSection';
export type { FilterList } from './CatalogFilterSection';
export { StyledChartDialog } from './ChartDialog';
export { LearningContent } from './LearningContent';
export { NavigationNavbar } from './NavigationNavbar';
Expand Down
44 changes: 44 additions & 0 deletions src/icons/CollapseAll/CollapseAllIcon.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import React from 'react';

interface CollapsAllIconProps {
height?: string;
width?: string;
fill?: string;
strokeWidth?: string;
style?: React.CSSProperties;
}

const CollapsAllIcon: React.FC<CollapsAllIconProps> = ({
height = '24',
width = '24',
fill = 'none',
strokeWidth = '2',
style
}) => (
<svg
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 24 24"
height={height}
width={width}
style={style}
>
<path
d="M17 16l-5-5-5 5"
fill={fill}
stroke="currentColor"
strokeWidth={strokeWidth}
strokeLinecap="round"
strokeLinejoin="round"
/>
<path
d="M17 10l-5-5-5 5"
fill={fill}
stroke="currentColor"
strokeWidth={strokeWidth}
strokeLinecap="round"
strokeLinejoin="round"
/>
</svg>
);

export default CollapsAllIcon;
1 change: 1 addition & 0 deletions src/icons/CollapseAll/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default as CollapseAllIcon } from './CollapseAllIcon';
44 changes: 44 additions & 0 deletions src/icons/ExpandAll/ExpandAllIcon.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import React from 'react';

interface ExpandAllIconProps {
height?: string;
width?: string;
fill?: string;
strokeWidth?: string;
style?: React.CSSProperties;
}

const ExpandAllIcon: React.FC<ExpandAllIconProps> = ({
height = '24',
width = '24',
fill = 'none',
strokeWidth = '2',
style
}) => (
<svg
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 24 24"
height={height}
width={width}
style={style}
>
<path
d="M7 8l5 5 5-5"
fill={fill}
stroke="currentColor"
strokeWidth={strokeWidth}
strokeLinecap="round"
strokeLinejoin="round"
/>
<path
d="M7 14l5 5 5-5"
fill={fill}
stroke="currentColor"
strokeWidth={strokeWidth}
strokeLinecap="round"
strokeLinejoin="round"
/>
</svg>
);

export default ExpandAllIcon;
1 change: 1 addition & 0 deletions src/icons/ExpandAll/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default as ExpandAllIcon } from './ExpandAllIcon';
3 changes: 3 additions & 0 deletions src/icons/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export * from './Circle';
export * from './Clone';
export * from './Close';
export * from './Cloud';
export * from './CollapseAll';
export * from './Column';
export * from './Component';
export * from './Configuration';
Expand All @@ -25,6 +26,7 @@ export * from './Designer';
export * from './Detail';
export * from './DropDownIcon';
export * from './Error';
export * from './ExpandAll';
export * from './Favorite';
export * from './Filter';
export * from './Fullscreen';
Expand All @@ -45,6 +47,7 @@ export * from './Design';
export * from './Done';
export * from './Download';
export * from './Edit';
export * from './EmptyStyle';
export * from './Environment';
export * from './ExternalLink';
export * from './Feedback';
Expand Down

0 comments on commit f7b688d

Please sign in to comment.