-
Notifications
You must be signed in to change notification settings - Fork 4
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
Conversation
1d9d907
to
94834ac
Compare
94834ac
to
361f038
Compare
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 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) |
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.
This is neat, I like this.
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.
Not sure if this is a good idea now, as we can't use, say, muted
or color
with onDesktop
.
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.
I still think this is a good idea though, even if it means changing onDesktop
or using a different pattern there
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.
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 |
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.
_flex
maybe belongs on Box the way muted
is tied to Text, but we can look into that in a separate PR
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.
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?
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.
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.
9bb1d97
to
b48850c
Compare
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.