I have following a course which used mui v4 and since a lot changed from v4 to v6, I can’t get all the styles although i managed and did my best and i am really stuck here.
This is my FeaturedMovie.jsx component
import React from 'react';
import { Typography, Box, Card, CardContent, CardMedia, styled } from '@mui/material';
import { Link } from 'react-router-dom';
const CardTypography = styled(CardContent)(({ theme }) => ({
color: '#fff',
width: '40%',
backgroundColor: 'transparent',
[theme.breakpoints.up('sm')]: {
width: '100%',
},
}));
function FeaturedMovie({ movie }) {
if (!movie) return null;
return (
<Box sx={{ marginBottom: '20px', display: 'flex', justifyContent: 'center', height: '490px', textDecoration: 'none' }} component={Link} to={`/movie/${movie.id}`}>
<Card sx={{ ':root': { position: 'relative' }, width: '100%', display: 'flex', justifyContent: 'flex-end', flexDirection: 'column' }}>
<CardMedia
sx={{ position: 'relative', top: 0, right: 0, height: '100%', width: '100%', backgroundColor: 'rgba(0,0,0,0.575)', backgroundBlendMode: 'darken' }}
media="picture"
alt={movie.title}
image={`https://image.tmdb.org/t/p/original/${movie?.backdrop_path}`}
title={movie.title}
/>
<Box padding="20px" bgcolor="black">
<CardTypography>
<Typography variant="h5" gutterBottom>{movie.title}</Typography>
<Typography variant="body2">{movie.overview}</Typography>
</CardTypography>
</Box>
</Card>
</Box>
);
}
export default FeaturedMovie;
I tried changing the bgcolor of the Box but it’s not becoming transparent instead becomes white,
i tried overiding the root styling but nothing seems to work.
I want the CardTypography(CardContent) to have position relative and bgcolor transparent,
in the course the guy overides the root styles using classes prop and gives styles to the root but in v6 the same can’t be done (there is nothing in the documentations).
Help me out here if someone knows how to do this.