1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-04-15 01:16:22 +02:00
unleash.unleash/frontend/src/component/project/Project/SuggestedChanges/DraftBanner/DraftBanner.tsx
Tymoteusz Czech b8c3833ae4
Suggest changes - initial frontend (#2213)
* feat: add initial controller

* feat: add fe

* feat: return status codes

* remove backend experiment

* refactor standalone route for project banner

* update suggest changeset type

* refactor changeset mock

* suggest changes banner feature flag

* fix: update routes snapshot

Co-authored-by: Fredrik Oseberg <fredrik.no@gmail.com>
2022-10-20 14:00:48 +02:00

64 lines
2.3 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { VFC } from 'react';
import { Box, Button, Typography } from '@mui/material';
import { useStyles as useAppStyles } from 'component/App.styles';
import WarningAmberIcon from '@mui/icons-material/WarningAmber';
import { ConditionallyRender } from 'component/common/ConditionallyRender/ConditionallyRender';
interface IDraftBannerProps {
environment?: string;
}
export const DraftBanner: VFC<IDraftBannerProps> = ({ environment }) => {
const { classes } = useAppStyles();
return (
<Box
sx={{
position: 'sticky',
top: 0,
zIndex: theme => theme.zIndex.appBar,
borderTop: theme => `1px solid ${theme.palette.warning.border}`,
borderBottom: theme =>
`1px solid ${theme.palette.warning.border}`,
backgroundColor: theme => theme.palette.warning.light,
}}
>
<Box className={classes.content}>
<Box
sx={{
display: 'flex',
alignItems: 'center',
px: 1,
py: 1.5,
color: theme => theme.palette.warning.main,
}}
>
<WarningAmberIcon />
<Typography variant="body2" sx={{ ml: 1 }}>
<strong>Draft mode!</strong> You have changes{' '}
<ConditionallyRender
condition={Boolean(environment)}
show={
<>
in <strong>{environment} </strong>
</>
}
/>
that need to be reviewed
</Typography>
<Button
variant="contained"
onClick={() => {}}
sx={{ ml: 'auto' }}
>
Review changes
</Button>
<Button variant="text" onClick={() => {}} sx={{ ml: 1 }}>
Discard all
</Button>
</Box>
</Box>
</Box>
);
};