Skip to content

makeStyles#9

Open
kevinresol wants to merge 1 commit intokLabz:masterfrom
kevinresol:makestyles
Open

makeStyles#9
kevinresol wants to merge 1 commit intokLabz:masterfrom
kevinresol:makestyles

Conversation

@kevinresol
Copy link
Copy Markdown
Contributor

The macro helps typing the said function correctly.

@kLabz
Copy link
Copy Markdown
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
Copy Markdown
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