Skip to content

Commit eb6cdd6

Browse files
authored
Merge pull request #940 from amvanbaren/bugfix/issue-936
Fix banner double button
2 parents 32252d3 + 8373ec5 commit eb6cdd6

File tree

1 file changed

+32
-58
lines changed

1 file changed

+32
-58
lines changed

webui/src/components/banner.tsx

Lines changed: 32 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -9,74 +9,48 @@
99
********************************************************************************/
1010

1111
import React, { FunctionComponent, PropsWithChildren } from 'react';
12-
import { Box, Paper, Card, Grid, Button, Divider, CardActions, CardContent, Hidden, Collapse } from '@mui/material';
12+
import { Paper, Grid, Button, Collapse } from '@mui/material';
1313

1414
export const Banner: FunctionComponent<PropsWithChildren<BannerProps>> = props => {
15-
const renderButtons = <>
16-
<Box sx={{ flexGrow: 1 }} component='span'/>
17-
<Grid item sx={{ whiteSpace: 'nowrap', alignSelf: 'flex-end', paddingLeft: '90px !important' }}>
18-
<Button
19-
variant='outlined'
20-
onClick={props.dismissButtonOnClick}
21-
>
22-
{props.dismissButtonLabel ?? 'Close'}
23-
</Button>
24-
</Grid>
25-
</>;
26-
2715
const cardColor = props.theme === 'dark' ? '#fff' : '#000';
2816
const cardBackground = `${props.color}.${props.theme}`;
2917
return <>
3018
<Collapse in={props.open}>
31-
<Paper elevation={0} sx={{ display: 'block', width: '100%', mx: 'auto' }}>
32-
<Card
33-
elevation={0}
34-
sx={{
19+
<Paper
20+
elevation={0}
21+
sx={{
22+
display: 'block',
23+
width: '100%',
24+
mx: 'auto',
25+
pb: 1, pr: 1, pl: 2, pt: 1.25,
26+
color: cardColor,
27+
bgcolor: cardBackground,
28+
'& a': {
3529
color: cardColor,
36-
bgcolor: cardBackground,
37-
'& a': {
38-
color: cardColor,
39-
fontWeight: 'bold'
40-
}
41-
}}
30+
fontWeight: 'bold'
31+
}
32+
}}
33+
>
34+
<Grid
35+
container
36+
spacing={2}
4237
>
43-
<CardContent sx={{ pb: 1, pr: 1, pl: 2, pt: 1.25 }}>
44-
<Grid
45-
container
46-
wrap='nowrap'
47-
spacing={2}
48-
direction='row'
49-
justifyContent='flex-start'
50-
alignItems='flex-start'
51-
>
52-
<Grid item sx={{ alignSelf: 'center' }}>
53-
{props.children}
54-
</Grid>
55-
{
56-
props.showDismissButton ?
57-
<Hidden smDown>
58-
{renderButtons}
59-
</Hidden> : null
60-
}
61-
</Grid>
62-
</CardContent>
38+
<Grid item xs={12} sm sx={{ alignSelf: 'center' }}>
39+
{props.children}
40+
</Grid>
6341
{
64-
props.showDismissButton ?
65-
<>
66-
<Hidden mdUp>
67-
<CardActions>
68-
{renderButtons}
69-
</CardActions>
70-
</Hidden>
71-
72-
<Hidden smDown>
73-
<div />
74-
</Hidden>
75-
</> : null
42+
props.showDismissButton &&
43+
<Grid item xs={12} sm='auto' sx={{ whiteSpace: 'nowrap', alignSelf: 'flex-end', paddingLeft: '90px !important' }}>
44+
<Button
45+
sx={{ float: 'right' }}
46+
variant='outlined'
47+
onClick={props.dismissButtonOnClick}
48+
>
49+
{props.dismissButtonLabel ?? 'Close'}
50+
</Button>
51+
</Grid>
7652
}
77-
</Card>
78-
79-
<Divider />
53+
</Grid>
8054
</Paper>
8155
</Collapse>
8256
</>;

0 commit comments

Comments
 (0)