Closed ackvf closed 6 years ago
To append a classname, classNames() or string concatenation must be used explicitly.
classNames()
<Icon className={classNames(classes.icon, 'fa fa-plus-circle')} /> <Icon className={classNames(classes.icon, 'fa fa-plus-circle')} color="primary"/> <Icon className={classNames(classes.icon, 'fa fa-plus-circle')} color="secondary"/>
This forces repetitivness and uglifies the code.
Proposed improvement is to allow custom classes in the theme object:
const styles = theme => ({ icon: { className: 'fa fa-plus-circle', // ... }, });
Usage
<Icon className={classes.icon} /> <Icon className={classes.icon} color="primary"/> <Icon className={classes.icon} color="secondary"/>
classes.icon here represents ${classes.icon} ${classes.icon.className} under the hood.
classes.icon
${classes.icon} ${classes.icon.className}
@ackvf https://github.com/cssinjs/jss-compose can help.
Current Behavior
To append a classname,
classNames()
or string concatenation must be used explicitly.This forces repetitivness and uglifies the code.
Expected Behavior & Example
Proposed improvement is to allow custom classes in the theme object:
Usage
classes.icon
here represents${classes.icon} ${classes.icon.className}
under the hood.