mirror of
https://github.com/Unleash/unleash.git
synced 2025-10-13 11:17:26 +02:00
## About the changes Refactoring the colors for the light theme to be much easier to continue with dark mode This is the first step to finish dark mode https://linear.app/unleash/project/[low][s][alpha]-dark-mode-in-unleash-admin-ui-31b407d13c4b/1 This PR uses `main-theme` as a placeholder for `dark-theme` for now due to the new changes. Still need to set the correct values here. --------- Co-authored-by: Nuno Góis <github@nunogois.com>
41 lines
980 B
TypeScript
41 lines
980 B
TypeScript
import { styled, useTheme } from '@mui/material';
|
|
import { FC } from 'react';
|
|
|
|
const StyledIndicator = styled('div')(({ style, theme }) => ({
|
|
width: '25px',
|
|
height: '25px',
|
|
borderRadius: '50%',
|
|
color: theme.palette.primary.contrastText,
|
|
display: 'flex',
|
|
alignItems: 'center',
|
|
justifyContent: 'center',
|
|
fontWeight: 'bold',
|
|
...style,
|
|
}));
|
|
|
|
interface IGuidanceIndicatorProps {
|
|
style?: React.CSSProperties;
|
|
type?: guidanceIndicatorType;
|
|
}
|
|
|
|
type guidanceIndicatorType = 'primary' | 'secondary';
|
|
|
|
export const GuidanceIndicator: FC<IGuidanceIndicatorProps> = ({
|
|
style,
|
|
children,
|
|
type,
|
|
}) => {
|
|
const theme = useTheme();
|
|
|
|
const defaults = { backgroundColor: theme.palette.primary.main };
|
|
if (type === 'secondary') {
|
|
defaults.backgroundColor = theme.palette.text.disabled;
|
|
}
|
|
|
|
return (
|
|
<StyledIndicator style={{ ...defaults, ...style }}>
|
|
{children}
|
|
</StyledIndicator>
|
|
);
|
|
};
|