aswi2022code-of-duty-gitlab/frontend/src/features/Reusables/ShowErrorIfPresent.tsx @ 14588cb6
1 |
import { Typography } from '@mui/material' |
---|---|
2 |
import { Fragment, FunctionComponent } from 'react' |
3 |
|
4 |
export interface ShowErrorProps { |
5 |
err?: string |
6 |
}
|
7 |
|
8 |
// Utility component for showing error messages
|
9 |
const ShowErrorIfPresent: FunctionComponent<ShowErrorProps> = ({ err }) => ( |
10 |
<Fragment> |
11 |
{err ? ( |
12 |
<Typography sx={{mb: 1}} align="center" variant="h6" color="error" fontWeight="bold"> |
13 |
{err} |
14 |
</Typography> |
15 |
) : null} |
16 |
</Fragment> |
17 |
)
|
18 |
|
19 |
export default ShowErrorIfPresent |