Skip to content
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

Modular Card component #857

Merged
merged 2 commits into from
Jun 18, 2015
Merged

Modular Card component #857

merged 2 commits into from
Jun 18, 2015

Conversation

chrismcv
Copy link
Contributor

I made a PR based on @tomesch 's very nice card component. #672

I've added basic docs and fixed a few lint issues.

I'm wondering about the avatar in the header, and whether this should be restructured to use the new avatar component?

@chrismcv chrismcv changed the title Create PR for card component Modular Card component Jun 15, 2015
@hai-cea
Copy link
Member

hai-cea commented Jun 16, 2015

@chrismcv Cool! :)

Yes, I think we should use the new Avatar component if possible. Thanks!

@mairh
Copy link

mairh commented Jun 16, 2015

@hai-cea Using Avatar component in Card header will inject too much dependency on using Avatar component from material-ui. Shouldn't we keep it optional and let the users decide what they want to place in Card header component.

I have my own custom Avatar component in my app which I can easily inject if it is not dependent on Avatar component from material-ui

@hai-cea
Copy link
Member

hai-cea commented Jun 16, 2015

@mairh That's a very good point - the way that I solved this was to just pass the avatar in as an element prop. You can see this in action in the list component. In your case, you'd just pass in your own Avatar component as the prop.

@chrismcv
Copy link
Contributor Author

How does this work for you both? Uses the build in avatar if providing a source, otherwise accepts whatever element is passed in. It will automatically add 16px margin-right to the avatar element whatever that is.

Commit unsquashed so you can see the changes clearly....

@mairh
Copy link

mairh commented Jun 16, 2015

Looks good

@tomesch
Copy link
Contributor

tomesch commented Jun 17, 2015

👍

@chrismcv
Copy link
Contributor Author

@hai-cea i've made the requested changes to tidy up... line-height does need px wondering if that is a sensible default?

@hai-cea
Copy link
Member

hai-cea commented Jun 17, 2015

@chrismcv Yes, I've been using px for line-heights.

@chrismcv
Copy link
Contributor Author

oops, i did but didn't do it.... 1 min

@chrismcv
Copy link
Contributor Author

that's you now - sorry about that

@chrismcv
Copy link
Contributor Author

(and your other changes are in now too)

@hai-cea
Copy link
Member

hai-cea commented Jun 17, 2015

@chrismcv I think it looks good. Is this ready to be merged? The only other thing we might want to consider is adding spread attributes to at least the root nodes of the new components and also merging styles as well. What do you think? This would allow users to pass down additional props to the component and custom styles.

@chrismcv
Copy link
Contributor Author

@hai-cea I think it's pretty much merge ready....
The card component has spread attributes already. The other components all have div's as their root, so i'm not sure what spreading adds here? As for merging styles, I think this is a good idea - I'll start putting this together now.

The only other feature(s) that might be useful for the component are 1) expand and collapse, and 2) responsive expanding and collapsing. e.g. <CardActions xs={false} sm={true}>...</...>

https://github.com/wearefractal/react-responsive seems to work well for this, but it is another dependency.

@hai-cea
Copy link
Member

hai-cea commented Jun 17, 2015

@chrismcv Sounds good to me - I think we can hold off on expand / collapse for a future PR.

The spread attribute would allow developers to attach events to those elements if they needed - but not a big issue for me either way and can always be added later.

@chrismcv
Copy link
Contributor Author

@hai-cea that's the style propable commit - have a skim and i'll squash when you're happy.

fair point about events - i've added spreads in.

@hai-cea
Copy link
Member

hai-cea commented Jun 17, 2015

@chrismcv Looks great. Thanks so much! 👍

@chrismcv
Copy link
Contributor Author

my pleasure :)

hai-cea pushed a commit that referenced this pull request Jun 18, 2015
@hai-cea hai-cea merged commit b596850 into mui:master Jun 18, 2015
@hai-cea
Copy link
Member

hai-cea commented Jun 18, 2015

Just merged - Thanks @chrismcv 👍

@chrismcv chrismcv deleted the card-component branch February 1, 2016 21:12
@zannager zannager added the component: card This is the name of the generic UI component, not the React module! label Mar 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: card This is the name of the generic UI component, not the React module!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants