Skip to content

[#135] Stop using parametric PropModifiers for styles and fix direction of style composition #145

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

Merged
merged 4 commits into from
May 1, 2020

Conversation

arthurxavierx
Copy link
Contributor

@arthurxavierx arthurxavierx commented Apr 30, 2020

This PR has 3 main effects:

  • Add the StyleModifier alias, so that style modifiers cannot reference props anymore.
  • Rename the styleModifier and styleModifier_ combinators to the less verbose style and style_.
  • Fix the direction of composition of style combinators (Reverse direction of PropModifier composition #135).

Now converting from style modifiers to Emotion's Style type is easy, since the toCSS function now just directly converts any StyleModifier to LumiTheme -> Emotion.Style.


-- | Flatten a `PropsModifier` and extract the Emotion styles for use with `React.Basic.Emotion.element`.
-- | This function is mainly used inside component implementations where the `LumiComponent` boundary
-- | gives way to DOM components or other `ReactComponent`s.
toCSS ::
forall props.
PropsModifier () ->
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@spicydonuts Since we're forcing the monomorphization of StyleModifier here we don't get any escaped skolem errors anymore :)

Copy link
Member

@maddie927 maddie927 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is excellent, thank you!

@arthurxavierx arthurxavierx changed the title Stop using parametric PropModifiers for styles [#135] Stop using parametric PropModifiers for styles and fix direction of style composition May 1, 2020
@arthurxavierx arthurxavierx merged commit 56a5526 into master May 1, 2020
@arthurxavierx arthurxavierx deleted the arthur/refactor/styles branch May 1, 2020 18:18
@arthurxavierx arthurxavierx mentioned this pull request May 4, 2020
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.

4 participants