Skip to content

Commit aabf2da

Browse files
authored
Merge pull request #147 from headlamp-k8s/fix_styles_prometheus
prometheus: Fix errors due to deprecated makeStyles
2 parents 1b2c305 + 9b12187 commit aabf2da

File tree

1 file changed

+19
-27
lines changed

1 file changed

+19
-27
lines changed

prometheus/src/components/Chart/common.tsx

+19-27
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,27 @@
11
import { useCluster } from '@kinvolk/headlamp-plugin/lib/k8s';
22
import { Button, Grid, Link, Paper, Typography } from '@mui/material';
3-
import makeStyles from '@mui/styles/makeStyles';
3+
import { styled } from '@mui/material/styles';
44
import { useHistory } from 'react-router-dom';
55
import skeletonImg from '../../../assets/chart-skeleton.png';
66
import { disableMetrics } from '../../util';
77
import { formatBytes, PLUGIN_NAME } from '../../util';
88

99
const learnMoreLink = 'https://github.com/headlamp-k8s/plugins/tree/main/prometheus#readme';
1010

11-
const useStyles = makeStyles(theme => ({
12-
skeletonBox: {
13-
backgroundImage: `url(${skeletonImg})`,
14-
backgroundSize: 'contain',
15-
backgroundRepeat: 'no-repeat',
16-
backgroundPositionX: 'center',
17-
height: '450px',
18-
color: theme.palette.common.black,
19-
},
20-
dismissButton: {
21-
backgroundColor: theme.palette.common.black,
22-
color: theme.palette.common.white,
23-
'&:hover': {
24-
color: theme.palette.primary.text,
25-
},
11+
const StyledGrid = styled(Grid)(({ theme }) => ({
12+
backgroundImage: `url(${skeletonImg})`,
13+
backgroundSize: 'contain',
14+
backgroundRepeat: 'no-repeat',
15+
backgroundPositionX: 'center',
16+
height: '450px',
17+
color: theme.palette.common.black,
18+
}));
19+
20+
const DismissButton = styled(Button)(({ theme }) => ({
21+
backgroundColor: theme.palette.common.black,
22+
color: theme.palette.common.white,
23+
'&:hover': {
24+
color: theme.palette.primary.text,
2625
},
2726
}));
2827

@@ -31,18 +30,16 @@ const useStyles = makeStyles(theme => ({
3130
* @returns {JSX.Element}
3231
*/
3332
export function PrometheusNotFoundBanner() {
34-
const classes = useStyles();
3533
const cluster = useCluster();
3634
const history = useHistory();
3735

3836
return (
39-
<Grid
37+
<StyledGrid
4038
container
4139
spacing={2}
4240
direction="column"
4341
justifyContent="center"
4442
alignItems="center"
45-
className={classes.skeletonBox}
4643
>
4744
<Grid item>
4845
<Typography variant="h5">Couldn't detect Prometheus in your cluster.</Typography>
@@ -67,16 +64,11 @@ export function PrometheusNotFoundBanner() {
6764
</Typography>
6865
</Grid>
6966
<Grid item>
70-
<Button
71-
className={classes.dismissButton}
72-
size="small"
73-
variant="contained"
74-
onClick={() => disableMetrics(cluster)}
75-
>
67+
<DismissButton size="small" variant="contained" onClick={() => disableMetrics(cluster)}>
7668
Dismiss
77-
</Button>
69+
</DismissButton>
7870
</Grid>
79-
</Grid>
71+
</StyledGrid>
8072
);
8173
}
8274

0 commit comments

Comments
 (0)