Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: review status draft * feat: add review status styles
- Loading branch information
1 parent
e3a185d
commit da102a3
Showing
3 changed files
with
175 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
73 changes: 73 additions & 0 deletions
73
...s/SuggestedChangeOverview/SuggestedChangeReviewStatus/SuggestChangeReviewStatus.styles.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
import { styled } from '@mui/material'; | ||
import { Cancel, CheckCircle } from '@mui/icons-material'; | ||
import { Box, Typography, Divider } from '@mui/material'; | ||
|
||
const styledComponentPropCheck = () => (prop: string) => | ||
prop !== 'color' && prop !== 'sx'; | ||
|
||
export const StyledFlexAlignCenterBox = styled(Box)(({ theme }) => ({ | ||
display: 'flex', | ||
alignItems: 'center', | ||
})); | ||
|
||
export const StyledErrorIcon = styled(Cancel)(({ theme }) => ({ | ||
color: theme.palette.error.main, | ||
height: '35px', | ||
width: '35px', | ||
marginRight: theme.spacing(1), | ||
})); | ||
|
||
export const StyledSuccessIcon = styled(CheckCircle)(({ theme }) => ({ | ||
color: theme.palette.success.main, | ||
height: '35px', | ||
width: '35px', | ||
marginRight: theme.spacing(1), | ||
})); | ||
|
||
export const StyledOuterContainer = styled(Box)(({ theme }) => ({ | ||
display: 'flex', | ||
marginTop: theme.spacing(2), | ||
})); | ||
|
||
export const StyledButtonContainer = styled(Box, { | ||
shouldForwardProp: styledComponentPropCheck(), | ||
})<{ approved: boolean }>(({ theme, approved }) => ({ | ||
borderRadius: `${theme.shape.borderRadiusMedium}px`, | ||
backgroundColor: approved | ||
? theme.palette.success.main | ||
: theme.palette.tableHeaderBackground, | ||
padding: theme.spacing(1, 2), | ||
marginRight: theme.spacing(2), | ||
height: '45px', | ||
width: '45px', | ||
display: 'flex', | ||
alignItems: 'center', | ||
justifyContent: 'center', | ||
['svg']: { | ||
color: approved | ||
? theme.palette.tertiary.background | ||
: theme.palette.neutral.main, | ||
}, | ||
})); | ||
|
||
export const StyledDivider = styled(Divider)(({ theme }) => ({ | ||
margin: theme.spacing(2.5, 0), | ||
})); | ||
|
||
export const StyledReviewStatusContainer = styled(Box, { | ||
shouldForwardProp: styledComponentPropCheck(), | ||
})<{ approved: boolean }>(({ theme, approved }) => ({ | ||
borderRadius: `${theme.shape.borderRadiusLarge}px`, | ||
border: approved | ||
? `2px solid ${theme.palette.success.main}` | ||
: `1px solid ${theme.palette.tertiary.main}`, | ||
padding: theme.spacing(3), | ||
width: '100%', | ||
})); | ||
|
||
export const StyledReviewTitle = styled(Typography, { | ||
shouldForwardProp: styledComponentPropCheck(), | ||
})<{ approved: boolean }>(({ theme, approved }) => ({ | ||
fontWeight: 'bold', | ||
color: approved ? theme.palette.success.main : theme.palette.error.main, | ||
})); |
100 changes: 100 additions & 0 deletions
100
...anges/SuggestedChangeOverview/SuggestedChangeReviewStatus/SuggestedChangeReviewStatus.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
import { FC } from 'react'; | ||
import { Box, Typography } from '@mui/material'; | ||
import { ReactComponent as ChangesAppliedIcon } from 'assets/icons/merge.svg'; | ||
import { ConditionallyRender } from 'component/common/ConditionallyRender/ConditionallyRender'; | ||
import { | ||
StyledOuterContainer, | ||
StyledButtonContainer, | ||
StyledReviewStatusContainer, | ||
StyledFlexAlignCenterBox, | ||
StyledSuccessIcon, | ||
StyledErrorIcon, | ||
StyledReviewTitle, | ||
StyledDivider, | ||
} from './SuggestChangeReviewStatus.styles'; | ||
|
||
interface ISuggestChangeReviewsStatusProps { | ||
approved: boolean; | ||
} | ||
|
||
export const SuggestedChangeReviewStatus: FC< | ||
ISuggestChangeReviewsStatusProps | ||
> = ({ approved }) => { | ||
return ( | ||
<StyledOuterContainer> | ||
<StyledButtonContainer approved={approved}> | ||
<ChangesAppliedIcon | ||
style={{ | ||
transform: `scale(1.5)`, | ||
}} | ||
/> | ||
</StyledButtonContainer> | ||
<StyledReviewStatusContainer approved={approved}> | ||
<StyledFlexAlignCenterBox> | ||
<ConditionallyRender | ||
condition={approved} | ||
show={<Approved approved={approved} />} | ||
elseShow={<ReviewRequired approved={approved} />} | ||
/> | ||
</StyledFlexAlignCenterBox> | ||
</StyledReviewStatusContainer> | ||
</StyledOuterContainer> | ||
); | ||
}; | ||
|
||
const Approved = ({ approved }: ISuggestChangeReviewsStatusProps) => { | ||
return ( | ||
<> | ||
<StyledFlexAlignCenterBox> | ||
<StyledSuccessIcon /> | ||
<Box> | ||
<StyledReviewTitle approved={approved}> | ||
Changed approved | ||
</StyledReviewTitle> | ||
<Typography> | ||
One approving review from requested approvers | ||
</Typography> | ||
</Box> | ||
</StyledFlexAlignCenterBox> | ||
|
||
<StyledDivider /> | ||
|
||
<StyledFlexAlignCenterBox> | ||
<StyledSuccessIcon /> | ||
<Box> | ||
<StyledReviewTitle approved={approved}> | ||
Changes are ready to be applied | ||
</StyledReviewTitle> | ||
</Box> | ||
</StyledFlexAlignCenterBox> | ||
</> | ||
); | ||
}; | ||
|
||
const ReviewRequired = ({ approved }: ISuggestChangeReviewsStatusProps) => { | ||
return ( | ||
<> | ||
<StyledFlexAlignCenterBox> | ||
<StyledErrorIcon /> | ||
<Box> | ||
<StyledReviewTitle approved={approved}> | ||
Review required | ||
</StyledReviewTitle> | ||
<Typography> | ||
At least 1 approving review must be submitted before | ||
changes can be applied | ||
</Typography> | ||
</Box> | ||
</StyledFlexAlignCenterBox> | ||
|
||
<StyledDivider /> | ||
|
||
<StyledFlexAlignCenterBox> | ||
<StyledErrorIcon /> | ||
<StyledReviewTitle approved={approved}> | ||
Apply changes is blocked | ||
</StyledReviewTitle> | ||
</StyledFlexAlignCenterBox> | ||
</> | ||
); | ||
}; |