Skip to content

Add new Text components #148

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 3 commits into from
Jun 9, 2020
Merged

Add new Text components #148

merged 3 commits into from
Jun 9, 2020

Conversation

arthurxavierx
Copy link
Contributor

Addressed the comments in #146 and changed the approach used for implementing the text modifiers. I've decided to create a new PR so that the old PR doesn't get too cluttered now that I've changed the implementation basis.

@arthurxavierx arthurxavierx self-assigned this May 11, 2020
@arthurxavierx arthurxavierx changed the title [WIP] Prototype new Text components Add new Text components May 19, 2020
@arthurxavierx arthurxavierx marked this pull request as ready for review May 19, 2020 19:01
Copy link
Contributor

@hdgarrood hdgarrood left a comment

Choose a reason for hiding this comment

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

The approach seems good to me, although I'm going to hold off on an 'official' approval because I think there are some subtleties to this I haven't quite appreciated yet.


-- | The `c` type parameter lets us constrain the type of component to which
-- | a text modifier may be applied: `Text`, `Header` or any.
type TextModifier c = forall r. PropsModifier (component :: c, type :: Maybe TextType | r)
Copy link
Contributor

Choose a reason for hiding this comment

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

This is neat, I like this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure if this is a good idea now, as we can't use, say, muted or color with onDesktop.

Copy link
Member

Choose a reason for hiding this comment

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

I still think this is a good idea though, even if it means changing onDesktop or using a different pattern there

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure if we can change onDesktop to fit this pattern given how the types work there. This means that props is (component :: c, type :: Maybe TextType), but onDesktop needs to be polymorphic on props, otherwise it can't provide the default values needed.

, row
$$$ [ T.paragraph
$ T.emphasized
$ _flex
Copy link
Member

Choose a reason for hiding this comment

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

_flex maybe belongs on Box the way muted is tied to Text, but we can look into that in a separate PR

Copy link
Contributor Author

@arthurxavierx arthurxavierx Jun 9, 2020

Choose a reason for hiding this comment

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

Not sure it belongs on Box. I believe flex may be applied to all block-level elements, and paragraph is a block element. Maybe we should start encoding element types somehow in the library?

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 looks really nice. We might want to look at the resulting PR in the Lumi repo before merging, but I don't think it's very risky to approve it since it's a new component.

@arthurxavierx arthurxavierx merged commit 12e327f into master Jun 9, 2020
@arthurxavierx arthurxavierx deleted the arthur/v2/text2 branch June 9, 2020 16:22
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.

3 participants