The error you are encountering, "type 'string' is not assignable to type 'undefined'," is likely because the makeStyles function from the library you are using expects certain values to be provided as specific types, and you are passing incorrect values.
It seems you are trying to use the makeStyles hook from Material-UI rather than Fluent UI. The makeStyles hook is designed to work with Material-UI's styling solution, and the format for specifying styles is slightly different from regular CSS.
To fix the issue and apply styles on hover, you need to use the makeStyles hook provided by Material-UI. Here's the corrected code:
import { makeStyles } from '@material-ui/core/styles';
const useStyles = makeStyles({
card: {
width: '100px',
height: '100px',
borderRadius: '10px', // Initial border-radius value
transition: 'border-radius 0.3s, background 0.3s', // Add transitions for smooth hover effect
'&:hover': {
borderRadius: '20px', // New border-radius value on hover
background: '#FF', // New background color on hover
boxShadow: 'another value here', // Add your desired boxShadow value for the hover state
},
},
});
function MyCard() {
const classes = useStyles();
return <div className={classes.card}>Your card content here</div>;
}
Make sure you have installed Material-UI (npm install @material-ui/core) and imported the necessary components correctly.
With these changes, when you hover over the card, the border-radius, background color, and boxShadow will be updated according to the styles specified in the &:hover section.