You could build an array up with classes conditionally:
const Card = () => {
const classNames = [styles.card];
if (items.length === 1) {
classNames.push(styles.blue);
} else if (items.length > 1) {
classNames.push(styles.green);
}
return (
<div className={classNames.join(' ')}>data</div>
)
};
Edit: Modified conditions to make more sense.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…