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

Image component #262

Merged
merged 13 commits into from
Jan 5, 2018
Merged

Image component #262

merged 13 commits into from
Jan 5, 2018

Conversation

snide
Copy link
Contributor

@snide snide commented Jan 4, 2018

Work in progress on an Image component. Need to discuss with @cchaos and figure out some stuff around sizing.

cc @alexfrancoeur @nreese. This will give you what you need for the expandable screenshots in the homepage v2.

Questions for review

  1. Should hasShadow be on by default?
  2. Should allowFullScreen be on by default?
  3. Should a default size be set?

@cchaos
Copy link
Contributor

cchaos commented Jan 4, 2018

Putting here mainly as a reminder:

We should be sure to require the alt attribute on img tags.

@snide snide requested review from cchaos and nreese January 4, 2018 20:58
Copy link
Contributor

@nreese nreese left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will be great for the home page.

What happened to the dungeons and dragons image?

</p>
<ul>
<li>
<EuiCode>size</EuiCode> accepts <EuiCode>s / m / l / original / fullWidth</EuiCode>.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing xl option

super(props);

this.state = {
isImageFullscreen: false,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should isImageFullscreen be camel-cased and be isImageFullScreen?

this.onKeyDown = this.onKeyDown.bind(this);
}

onKeyDown = event => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not passed as a prop to anything so pressing the esc key does not close the full screen image

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ha. Knew I forgot something ;-)

@snide
Copy link
Contributor Author

snide commented Jan 4, 2018

@nreese Feedback addressed and added an ESC to close mechanism.

Copy link
Contributor

@nreese nreese left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

Copy link
Contributor

@cchaos cchaos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. No shadow should not be default -- Should shadow only show if it's clickable?
  2. Allow full screen is harder because it should really only happen if the image is displayed much smaller than the original. Not sure what the typical implementation will be.
  3. I think the default size should be original.

Do we want to address the hover states (icon overlay) in this PR or later?

<ul>
<li>
<EuiCode>size</EuiCode> accepts <EuiCode>s / m / l / xl / original / fullWidth</EuiCode>.
The later will set the figure to stretch to 100% of its container.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sp: "later" -> "latter"

</li>
<li>
<EuiCode>caption</EuiCode> will provide a caption to the image.
</li>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

title is a prop as well

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed

text: (
<p>
Images can be sized by passing the <EuiCode>size</EuiCode> prop a value
of <EuiCode>s / m / l / original / fullWidth</EuiCode>.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add 'xl' to this list as well

@snide
Copy link
Contributor Author

snide commented Jan 5, 2018

OK. Feedback addressed.

  1. Gonna keep the shadow as on by default since it matches our other elements (like form elements) which have a similar small shadow. Ability is still there to turn it off.
  2. allowFullScreen is set to off by default. Updated the doc examples.
  3. Default size set to original.

I also went ahead and added a small expand icon. This requires a new prop fullScreenIconColor though because the images might be dark or light and need a different color hover icon. So added that as well.

Copy link
Contributor

@cchaos cchaos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, except for one inconsistency with fullScreenIconColor.

allowFullScreen
caption="I am a starship. Zooom!"
title="Click me to see in full screen."
fullScreenIconColor="default"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be fullScreenIconColor="dark" not default?

@cchaos
Copy link
Contributor

cchaos commented Jan 5, 2018

Oh and I just saw two more things, the second one we can either address now or when we do more in-depth documentation.

  1. The title attribute should actually be alt
  2. The title/alts of the image examples aren't correct alt descriptions. They should be describing the image not describing the interaction. I only mention this since we want to be sure that even our examples are fully correct so that someone who may be copy and pasting these directly from the examples will know what needs to be replaced, else they may just keep that title as is.

@snide
Copy link
Contributor Author

snide commented Jan 5, 2018

Good spots. Flipped the alts in, adjusted their text and fixed that default/dark issue. Gonna merge.

@snide snide merged commit 9ec3e40 into elastic:master Jan 5, 2018
@snide snide deleted the feature/image branch January 5, 2018 22:07
@alexfrancoeur
Copy link

@snide woah! this is a fantastic surprise, awesome turnaround guys. @nreese is this something we can use in 6.2 or should I add to the enhancement issue I'll be creating for Kibana Home?

@nreese
Copy link
Contributor

nreese commented Jan 8, 2018

@alexfrancoeur Its already in 6.2 and being used on the home page

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants