-
Notifications
You must be signed in to change notification settings - Fork 0
WIP on the first idea #4
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
base: master
Are you sure you want to change the base?
Conversation
props.active ? ButtonStyles.activeStyle : null, | ||
state.hover ? ButtonStyles.hoverStyle : null, | ||
state.focus ? ButtonStyles.focusStyle : null | ||
].concat(props.styles); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The next version of React Style will have pseudo classes and should make this code smaller.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for that hint. Out of interest: How will you support pseudo classes in React Styles - using JavaScript to detect the hover and then update the styles or do you plan to emit a piece of CSS to use the browser :hover { ... }
selector?
Just pushed a few more changes. These changes move the code further away from <Button styles={[ButtonStyles.error, ApplicationStyles.childStyle]}> and ended up introducing what I call "composer" functions, such that the above becomes now: <Button styleDef={ButtonStyles.error(ApplicationStyles.childStyle)]}> The points 3) onwards in the README.md should hopefully give you and idea about the changes and the last point 7) covers the idea behind the composer functions. The idea about composer functions is highly inspired by the blog post Mixins Are Dead. Long Live Composition, which talks about the trend in React to move away from mixins and towards composition, and the linearization concept in type systems like Scala. In fact, many of the latest changes came to my mind when thinking about extending CSS classes as a problem in other object oriented programming languages. As always, if you have any questions or want me to explain details in more depth, please let me know. Do you think the idea about the "composer functions" is too far fetched or do you think they actually make sense? I personally like the idea very much but I am not sure if my love for type systems makes me biased here. |
Aka, if you want, I am happy to write up more about the composer idea and turn it into a blog post :) |
1388347
to
accf64f
Compare
Two small changes that I've just pushed:
|
…s wrong with composition though
No description provided.