Conversation
I'd probably go with a specific primary content, and a secondary content to have everything flexible. |
So, we'd have a PrimaryContent and SecondaryContent components? Also, there's this difference between "secondary content" and "secondary actions", and the latter can be a link or a button, if I'm not mistaken. |
The I'm just throwing some ideas, I'd need to think about it. I'd like to provide an easy way to create a list of items (where the item is a link, like in the drawer for example), and the possibility to have that fully customizable :) |
The However, I don't get your second paragraph. What we could do is providing a |
Do you mean having List > ListItem > ListItemPrimary & ListItemSecondary > ListAction ? Or replacing Secondary with Action? |
For example, this code (3rd example on Components section of MDL): <div class="demo-list-action mdl-list">
<div class="mdl-list__item">
<span class="mdl-list__item-primary-content">
<i class="material-icons mdl-list__item-avatar">person</i>
<span>Bryan Cranston</span>
</span>
<a class="mdl-list__item-secondary-action" href="#"><i class="material-icons">star</i></a>
</div>
<div class="mdl-list__item">
<span class="mdl-list__item-primary-content">
<i class="material-icons mdl-list__item-avatar">person</i>
<span>Aaron Paul</span>
</span>
<a class="mdl-list__item-secondary-action" href="#"><i class="material-icons">star</i></a>
</div>
<div class="mdl-list__item">
<span class="mdl-list__item-primary-content">
<i class="material-icons mdl-list__item-avatar">person</i>
<span>Bob Odenkirk</span>
</span>
<span class="mdl-list__item-secondary-content">
<a class="mdl-list__item-secondary-action" href="#"><i class="material-icons">star</i></a>
</span>
</div>
</div> Would be: <List>
<ListItem>
<ListPrimaryContent icon="person">Bryan Cranston</ListPrimaryContent>
<ListItemAction icon="star" onClick={/* ... */} />
</ListItem>
{/* ... */}
</List> |
Oh I see... The secondary content is always an action... Well.. the spec calls everything an action, but MDL only use action for the secondary content. I won't put any event handler on that item, because it can be a checkbox or any other component... |
I think we could rename everything though.. I'm suggesting this: What do you think? |
Everything seems clearer and precise now. Do we still agree that If so, then it's alright. Attaching If everything is alright, I could start writing it today. |
We can see this of 2 different ways I thing. Either the component takes a I don't know if using |
Keeping the However, the point with CSS classes is that the parent must have it ( I think we're all set, aren't we? |
Yep :-) Lets see some code and we'll see how it behaves :) |
I'm currently working on it. Have actually done a lot, and the trickiest part is over, I guess. Expect more commits by the end of the day. :) |
I can't get to pass the Travis tests while it passes on my machine... Do you have any idea what it could be? @tleunen |
You can see the job task here https://travis-ci.org/tleunen/react-mdl/builds/108559317 Please come on discord if you wanna discuss about it ;) |
|
||
const children = React.Children.map(this.props.children, child => { | ||
const toAdd = 'mdl-list__item-secondary-action'; | ||
const childClassName = child.props.className ? `${child.props.className} ${toAdd}` : toAdd; |
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.
you can use classNames('mdl-list__item-secondary-action', child.props.className)
instead :)
const { className, twoLine, threeLine, ...otherProps } = this.props; | ||
|
||
const classes = classNames('mdl-list__item', { | ||
'mdl-list__item--two-line': twoLine, |
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.
twoLine && !threeLine
.
same on the line below
(I'm still unsure about using a trailing s
or not. Feels weird to not have it though :/)
|
||
let { children } = this.props; | ||
|
||
try { |
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'm not a big fan of try catch, especially in this case. The propType should be enough.
Thank you for your feedback! It helps me get better with React. I have fixed most of the things, except the part for the icon/avatar point. We need to design this as well. |
@@ -0,0 +1,3 @@ | |||
import basicClassCreator from '../utils/basicClassCreator'; |
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.
You can move this in a src/List/index.js
with the other imports as well. No need of a specific file since the end user will never import only this one (he won't be able to do much only with this)
Okay, tomorrow I'll work on |
Any news on this? I can continue the work if needed |
Thank you @darenju for the work. I really would like to publish the new version today so I'll complete the work here with the said modifications and the documentation. |
Sorry I haven't replied. I actually did some work, but was celebrating my birthday meanwhile. I'm glad my work has been merged. 👍 |
Adds support of List, and List Item component. #201
Still thinking of how "primary content", "secondary content" & friends should be implemented. Would need help on that.