fix: query builder filter label is adopted for dark mode (#2683)

Co-authored-by: Srikanth Chekuri <srikanth.chekuri92@gmail.com>
This commit is contained in:
Palash Gupta 2023-05-11 13:56:29 +05:30 committed by GitHub
parent 38bfc41190
commit 25398d9d35
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 4 deletions

View File

@ -38,6 +38,8 @@ const themeColors = {
whiteCream: '#ffffffd5',
black: '#000000',
lightgrey: '#ddd',
borderLightGrey: '#d9d9d9',
borderDarkGrey: '#424242',
};
export { themeColors };

View File

@ -1,6 +1,10 @@
import { themeColors } from 'constants/theme';
import styled from 'styled-components';
export const StyledLabel = styled.div`
interface Props {
isDarkMode: boolean;
}
export const StyledLabel = styled.div<Props>`
padding: 0 0.6875rem;
min-height: 2rem;
min-width: 5.625rem;
@ -8,6 +12,8 @@ export const StyledLabel = styled.div`
white-space: nowrap;
align-items: center;
border-radius: 0.125rem;
border: 0.0625rem solid #434343;
background-color: #141414;
border: ${({ isDarkMode }): string =>
`1px solid ${
isDarkMode ? themeColors.borderDarkGrey : themeColors.borderLightGrey
}`};
`;

View File

@ -1,3 +1,4 @@
import { useIsDarkMode } from 'hooks/useDarkMode';
import React, { memo } from 'react';
// ** Types
@ -8,5 +9,7 @@ import { StyledLabel } from './FilterLabel.styled';
export const FilterLabel = memo(function FilterLabel({
label,
}: FilterLabelProps): JSX.Element {
return <StyledLabel>{label}</StyledLabel>;
const isDarkMode = useIsDarkMode();
return <StyledLabel isDarkMode={isDarkMode}>{label}</StyledLabel>;
});