Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

makeStyles #9

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

makeStyles #9

wants to merge 1 commit into from

Conversation

kevinresol
Copy link
Contributor

The macro helps typing the said function correctly.

@kLabz
Copy link
Owner

kLabz commented Jan 8, 2020

I have a variant here that should be more complete (usage with or without theme), and also allows using css.Properties enum values like Styles.jss(...) does for withStyles.

Example usage:

import mui.core.styles.MuiTheme;
import mui.core.styles.Styles;

private typedef TClasses = Classes<[fullHeight]>;

// ...

var styles:TClasses = Styles.makeStyles({
	fullHeight: {
		display: "flex",
		position: Relative,
		height: "100%",
		"@media print": {
			borderRadius: 0,
			boxShadow: "none"
		}
	}
})();

console.dir(styles);
trace(styles.fullHeight);

var styles:TClasses = Styles.makeStyles(
	(theme:DefaultTheme) -> Styles.jss({
		fullHeight: {
			color: theme.palette.text.primary
		}
	})
)(theme);

console.dir(styles);
trace(styles.fullHeight);

@kLabz
Copy link
Owner

kLabz commented Jan 13, 2020

Does this work for your use case?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants