I am new to using Material UI with ReactJS, and trying to change the color of typography.
I don't know where to start. like I want to turn the text into the color red if the text is equal to Not Available and green if Available
This is my code:
const colors = () => {
if ('Product_Status' == 'Not Available')
return ('red');
else
return ('green');
};
<ImageList sx={{ width: 500, height: 450 }} cols={2} gap={15}>
{/* Mapping image */}
{category.map(
// For each process
item => (
<ImageListItem key={item.Product_ID}>
{/* Image property */}
<img
src={item.Product_image}
alt={item.Product_name}
loading="lazy"
/>
<ImageListItemBar
title={<Typography variant="h4" color="White">{item.Product_name} </Typography>}
subtitle={<Typography variant="h6" color="White">₱ {item.Product_price} <br />
{item.Product_category} <br />
<Typography variant="h6" color={colors}> {item.Product_Status} </Typography>
</Typography>}