Skip to content

Commit

Permalink
backgroud color and text color changed for filters dropdowns in dark …
Browse files Browse the repository at this point in the history
…mode in host app
  • Loading branch information
vihangckale authored and sadanandpai committed Jul 14, 2024
1 parent 8886639 commit 5fa4a8f
Showing 1 changed file with 30 additions and 1 deletion.
31 changes: 30 additions & 1 deletion apps/host/src/components/common/multi-select/multi-select.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import React from 'react';
import React, { useContext } from 'react';
import ReactSelect, { MultiValueProps, OptionProps } from 'react-select';
import { components } from 'react-select';
import { OptionType } from '../../../../../../shared/data/types/common';
import PropTypes from 'prop-types';
import { ThemeContext } from '@/components/ThemeWrapper';

const Option = (props) => {
return (
Expand Down Expand Up @@ -37,6 +38,7 @@ const CustomSelect: React.FC<Props> = ({
optionSelected,
setOptionSelected,
}) => {
const { theme } = useContext(ThemeContext);
const handleChange = (selected: OptionType[]) => {
setOptionSelected(selected);
};
Expand Down Expand Up @@ -64,10 +66,37 @@ const CustomSelect: React.FC<Props> = ({
border: '2px solid #ccc',
maxHeight: '200px',
overflowY: 'auto',
background: theme === 'dark' ? '#000000' : '#ffffff',
}),
menuList: (base) => ({
...base,
textAlign: 'left',
background: theme === 'dark' ? '#000000' : '#ffffff',
}),
option: (base, state) => {
const isDarkTheme = theme === 'dark';
const isLightTheme = theme === 'light';
const isSelected = state.isSelected;
const isFocused = state.isFocused;
return {
...base,
color: isSelected ? '#ffffff' : isDarkTheme && isFocused ? '#000000' : 'inherit',
background: (() => {
if (isDarkTheme) {
if (isSelected) return 'blue';
if (isFocused) return '#ffffff';
}
if (isLightTheme) {
if (isSelected) return '#2684FF';
if (isFocused) return '#B2D4FF';
}
return 'initial';
})(),
};
},
placeholder: (base) => ({
...base,
color: theme === 'dark' ? '#b0b3b8' : 'grey',
}),
}}
/>
Expand Down

0 comments on commit 5fa4a8f

Please sign in to comment.