-
Notifications
You must be signed in to change notification settings - Fork 844
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
EuiCards #385
EuiCards #385
Conversation
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.
Chatted a bit over slack.
- Needs focus states to work (just needs accessible wrapper for onclick).
- Should add a custom validator similar to our buttons, so that you can't use icon AND image together.
src/components/card/_card.scss
Outdated
} | ||
|
||
.euiCard__image { | ||
.euiIcon { |
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 add a class for this instead of overwriting through nests.
src/components/card/_card.scss
Outdated
margin-bottom: $euiCardSpacing; | ||
} | ||
|
||
.euiImage { |
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.
Same here.
src/components/panel/_panel.scss
Outdated
&:hover, | ||
&:focus { | ||
transform: translateY(-2px); | ||
@include euiSlightShadowHover; |
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.
Prolly just move this a line up.
src/components/card/card.js
Outdated
let imageNode; | ||
if (image) { | ||
imageNode = ( | ||
<EuiImage url={image} alt="" /> |
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.
Maybe pass the title in the alt?
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 left the alt blank here on purpose since the image should not be representing content or describing something in this instance. It's strictly a visual aid to the card's title. Adding the card title to the alt will make the screen ready read the card's title twice.
src/components/panel/panel.js
Outdated
}; | ||
|
||
EuiPanel.defaultProps = { | ||
paddingSize: 'm', | ||
hasShadow: false, | ||
grow: true, | ||
isHoverable: false, |
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.
Maybe add some auto-gen prop docs to this to explain it.
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.
We should probably also document this on the EuiPanel
page as well. Doubtful it would be used outside of a card, but prolly a good idea.
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.
Done
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.
Blargh. I suck at GH today.
Address comments and open for final review. |
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 fantastic! I just had one suggestion.
src/components/panel/panel.js
Outdated
@@ -50,10 +52,12 @@ EuiPanel.propTypes = { | |||
paddingSize: PropTypes.oneOf(SIZES), | |||
grow: PropTypes.bool, | |||
panelRef: PropTypes.func, | |||
isHoverable: PropTypes.bool, |
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.
Unless we can think of a situation where we want this behavior to be uncoupled from an onClick
callback, then I think it's worth just renaming this to be onClick: PropTypes.func
. WDYT?
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.
So we should pass the onClick from EuiCard onto EuiPanel?
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 can think of situations where you wouldn't want the card to bounce, but still want onClick. Common one would be W I D E P A N E L that is skinny vertically.
Hey, DO THIS THING, IM A BIG CALLOUT at the top.
Putting the hover on the card when it's such a large element is usually something you wouldn't want. Normally works better for bite-sized repeatable elements (which is the common scenario).
But you're right it's not gonna happen very often.
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 I know what you're talking about. I've seen that pattern on the Bootstrap site. It's pretty neat though at first I didn't realize it was clickable. Maybe that pattern should require a button inside the panel instead? Or a new kind of component which has a noticeable hover state, like a background change?
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 that's better for documenting patterns though. Large panels like jumbotrons should have buttons as actions not be an action itself.
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.
Yay. Cards.
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.
🌞
… if it exists Also making Card’s text left aligned by default.
@cjcenizal & @snide Can you take one more look at this (mainly just that last commit). On @cjcenizal's request, I passed the onClick handler to the EuiPanel and changed the outer element to a Also, I realized there may be good cases for cards that have their content left aligned vs centered, so I gave it a |
…defaulting to ‘right’
@cchaos Looks good to me. Make your prop "textAlign" instead of "alignment" just so it's a little more specific to what it does. I think the |
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.
Looks awesome!
First pass at creating a card component.
onClick
attribute exists, it will apply the newisHoverable
prop to the containingEuiPanel
for hover effectsTo do: