1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-09-19 17:52:45 +02:00
unleash.unleash/frontend/src/component/common/GuidanceIndicator/GuidanceIndicator.tsx
Fredrik Strand Oseberg d4fcf52020 feat/playground-second-iteration (#1139)
* fix: rearrange ui

* fix: make request on load

* fix: default to the first environment

* feat: add codemirror

* fix: layout

* fix: styling

* feat: add popover

* feat: variant popover

* fix: add sticky

* feat: resolve input

* refactor: date field

* fix: move deps

* fix: clean up any

* fix: resolve import

* fix: hide columns on mobile

* fix: search style

* fix: rename styles

* fix: PR comments

* fix: add popover for guidance

* fix: guidance popover

* fix: verbose function

* fix: wording

Co-authored-by: Tymoteusz Czech <2625371+Tymek@users.noreply.github.com>
2022-07-22 13:15:28 +02:00

41 lines
981 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.text.tertiaryContrast,
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.tertiary.dark;
}
return (
<StyledIndicator style={{ ...defaults, ...style }}>
{children}
</StyledIndicator>
);
};