Skip to content

Commit

Permalink
Add missing file that for some reaso wasn't in the previous commit
Browse files Browse the repository at this point in the history
  • Loading branch information
erikao1998 committed Nov 24, 2023
1 parent f742bbf commit e5ab59a
Showing 1 changed file with 57 additions and 0 deletions.
57 changes: 57 additions & 0 deletions src/client/components/ResultPage/RiskElement.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
import React from 'react'
import { Box, Grid, Typography } from '@mui/material'
import Markdown from '../Common/Markdown'

export interface RiskElementProps {
// eslint-disable-next-line react/require-default-props
infoText?: string
resultText: string
risk: number
}

const RiskElement = ({ infoText, resultText, risk }: RiskElementProps) => {
const colors: any = {
1: '#2ecc71',
2: '#f1c40f',
3: '#e74c3c',
}
return (
<Box sx={{ paddingBottom: '10px', paddingLeft: '20px' }}>
<Grid
container
spacing={2}
direction="row"
alignItems="baseline"
justifyContent="space-between"
>
<Grid item>
<Box>
<Typography variant="body1">{resultText}</Typography>
</Box>
</Grid>
<Grid item>
<Box
sx={{
display: 'flex',
justifyContent: 'center',
alignItems: 'center',
minHeight: '50px',
backgroundColor: colors[risk],
width: '40px',
borderRadius: '25%',
}}
>
{risk}
</Box>
</Grid>
</Grid>
{infoText && (
<Box sx={{ width: '90%' }}>
<Markdown>{infoText}</Markdown>
</Box>
)}
</Box>
)
}

export default RiskElement

0 comments on commit e5ab59a

Please sign in to comment.