-
-
Notifications
You must be signed in to change notification settings - Fork 32.5k
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
[Doc] Convert Dialog to use the new standard. #2483
Conversation
@@ -0,0 +1,6 @@ | |||
## Dialog | |||
|
|||
Dialog can only be a controlled component. |
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.
Could you add a link to https://www.google.com/design/spec/components/dialogs.html?
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.
on it
@subjectix Wow, that's some hard work here! |
/** | ||
* The `className` to add to the `Dialog` window content container. | ||
* This is the `Paper` element that is seen when the `Dialog` is shown. | ||
*/ |
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.
Should we add the className property in the doc?
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.
yeah, but who will take the className? I wanted to ask, I forgot 😅
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 think we have to make an standard.
for each xxxStyle we should have xxxClassName and for each style a className, don't you think?
Thanks ^^ |
I'll take a look at the test |
@oliviertassinari I fixed the test and added a whole bunch of props for completeness. This is only for demonstration, please take a long good look at my PR 👯 Do you think this set of (standardized) props make the library a lot easier to customize? or it only bloats the components? |
@newoga I'd like to hear your idea on this one too, if you don't mind ^^ |
@subjectix, this is a very interesting problem and something I've been considering lately. Below are some of my initial thoughts: My first thought is, either way, I like standardization and API predictability. The consistent Some possible problems in the current implementation that come to mind that we might have to look into/investigate further are: 1. Style precedence may limit effectiveness of Based on my understanding, right now for most of our components, when users provide their own Since inline styles always take precedence over classes, will our default/internal style definitions ultimately override css properties that matter the most? Simple example would be if someone attempted to do this: .dialog-title {
color: 'orange';
} <Dialog {...other} titleClassName="dialog-title" /> Unless we'd have the ability to export our internal inline-styles to stylesheets and have them loaded before theirs, I think their css class would be ineffective in this particular use case. 2. Possible increased API surface area for components that have several layers of deeply nested children I think you suggested that this might be a concern. I don't think any of our current components excessively suffer from this right now, but I think it's valid concern nonetheless. Since I recently worked with the Other random thoughts: I'd be interested in exploring programatic approaches for developers to hook into the style transformation for material-ui components, or approaches that allow consumers to essentially It might mean that components like I know it's really abstract right now. I haven't tried anything but I think it's certainly possible. Part of me wonders if something like this will be a necessity to even support desktop on native/mobile at the same time. |
Well it's a common pattern for those who want to override react inline styles with css classes to use the
I think this is a valid trade-off, maybe if we can categorize props and make separate tables for But maybe, if the users see xxxClassName and xxxStyle all over the place, they'll easily get used to it. a limiting API is much worse than an over populated one, imo. @oliviertassinari Thoughts? |
I definitely agree with this. If I'm honest with myself, I think it feels more natural for components to be able to accept both classes and styles so they feel more normal.
From a pure maintenance standpoint, having |
@newoga Well the issue isn't maintenance actually, I just want to follow the best convention and make it standard from now on. Need to have people agreeing with this approach. This is not a small decision :D |
@oliviertassinari Take a final look at this when you get the time ^_^ |
children: React.PropTypes.node, | ||
|
||
/** | ||
* The `className` to add to the `Dialog` root element. |
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.
What about The css class name of the root element.
?
Could you update the example of the
|
@@ -116,20 +117,26 @@ const DialogInline = React.createClass({ | |||
|
|||
propTypes: { | |||
actionFocus: React.PropTypes.string, | |||
actions: React.PropTypes.array, | |||
actions: React.PropTypes.node, | |||
actionsContainerClassName: React.PropTypes.string, |
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.
Double spaces here. The rule relative eslint rule is not inforced yet.
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.
ok, thanks.
@subjectix I have done some comment on the code. Otherwise, that a great improvement for this component 👍. |
@oliviertassinari Please take another look, I remove |
What about renaming |
@oliviertassinari Ok, I'll change the names, squash and merge, thanks for your feedbacks 👍 😄 |
a9f7106
to
4074a1f
Compare
[Doc] Convert Dialog to use the new standard.
🎉 |
@oliviertassinari What do you think?