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

Add hrefs to left menu links #1523

Merged
merged 4 commits into from
Aug 4, 2017
Merged

Add hrefs to left menu links #1523

merged 4 commits into from
Aug 4, 2017

Conversation

Hypnosphi
Copy link
Member

This improves UX by making it possible to open stories in new tab/window, copy links etc.

@shilman
Copy link
Member

shilman commented Jul 26, 2017

@igor-dv mind taking a look at this?

@shilman shilman requested a review from igor-dv July 26, 2017 00:42
@igor-dv
Copy link
Member

igor-dv commented Jul 26, 2017

@Hypnosphi , cool thing, but:

There will be incompatible changes in the left panel structure in upcoming 3.2 release , so I think you should branch from the release/3.2

Copy link
Member

@igor-dv igor-dv left a comment

Choose a reason for hiding this comment

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

Let's review after the compatibility changes

@ndelangen
Copy link
Member

@Hypnosphi Awesome!! Do you think you could resolve the merge conflicts?

@Hypnosphi
Copy link
Member Author

Those changes may be non-trivial to integrate with react-treebeard, but I'd give it a try

@ndelangen
Copy link
Member

If you need help, just let me know! If you'd like to join the storybook slack, you can self-invite here: https://now-examples-slackin-nqnzoygycp.now.sh/

@igor-dv
Copy link
Member

igor-dv commented Jul 28, 2017

@Hypnosphi , look at HeaderDecorator in ui/components/left_panel/stories_tree/tree_decorators.js . There is a <a> tag that you can replace.

@Hypnosphi
Copy link
Member Author

Hypnosphi commented Jul 28, 2017

@igor-dv Sure, but I also need to put onclick handler on that link instead of this div: https://github.com/alexcurtis/react-treebeard/blob/master/src/components/decorators.js#L55

In fact, I think the whole Container should be a link (because it's the clickable area)

@codecov
Copy link

codecov bot commented Jul 29, 2017

Codecov Report

Merging #1523 into master will increase coverage by 0.17%.
The diff coverage is 53.08%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1523      +/-   ##
==========================================
+ Coverage   20.41%   20.59%   +0.17%     
==========================================
  Files         241      244       +3     
  Lines        5255     5308      +53     
  Branches      654      653       -1     
==========================================
+ Hits         1073     1093      +20     
- Misses       3681     3719      +38     
+ Partials      501      496       -5
Impacted Files Coverage Δ
...i/components/left_panel/stories_tree/tree_style.js 25% <ø> (ø) ⬆️
...les/ui/components/left_panel/stories_tree/index.js 100% <ø> (ø) ⬆️
lib/ui/src/modules/ui/containers/routed_link.js 100% <100%> (ø)
lib/ui/src/modules/ui/components/routed_link.js 100% <100%> (ø)
lib/ui/src/modules/ui/components/menu_item.js 19.14% <33.33%> (ø)
...ponents/left_panel/stories_tree/tree_decorators.js 33.33% <46.87%> (+3.75%) ⬆️
lib/ui/src/modules/ui/configs/handle_routing.js 28.04% <66.66%> (-0.9%) ⬇️
addons/knobs/src/components/types/Number.js 8.06% <0%> (ø) ⬆️
addons/knobs/src/components/PropForm.js 8.51% <0%> (ø) ⬆️
... and 26 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9b0dabe...c4bfa31. Read the comment docs.

@igor-dv
Copy link
Member

igor-dv commented Jul 30, 2017

@Hypnosphi LMK, when it's ready to review.

@Hypnosphi
Copy link
Member Author

@igor-dv I think it is

Copy link
Member

@igor-dv igor-dv left a comment

Choose a reason for hiding this comment

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

LGTM,

The only thing I am not confident about is the final blue/black UI.

image

  1. I think it's too much blue...
  2. IMO making the Component name bold together with a story is a bit confusing..


// Cmd/Ctrl/Shift/Alt + Click should trigger default browser behaviour. Same applies to non-left clicks
function isPlainLeftClick(e) {
return e.button === 0 && !e.altKey && !e.ctrlKey && !e.metaKey && !e.shiftKey;
Copy link
Member

Choose a reason for hiding this comment

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

extract 0 to some const for readability

Copy link
Member Author

Choose a reason for hiding this comment

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

Will do

}

render() {
const { onClick, href, children, overrideParams, ...restProps } = this.props;
Copy link
Member

Choose a reason for hiding this comment

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

I assume that you destructure onClick and overrideParams here to not pass them to the a.
If so, consider using something like this ?

const newProps = {
  ...this.props,
  onClick: this.onClick,
  overrideParams: null,
};

return (
  <a {...newProps}></a>
);

Copy link
Member Author

Choose a reason for hiding this comment

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

Null is also a value. Try and pass it to some dom element, react warns you (and from version 16 it will silently append it as an attribute)

Copy link
Member

Choose a reason for hiding this comment

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

Crap... those unused props are annoying me..

Copy link
Member Author

@Hypnosphi Hypnosphi Jul 31, 2017

Choose a reason for hiding this comment

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

plus we need explicit href and children to make eslint-plugin-jsx-a11y happy

Copy link
Member

Choose a reason for hiding this comment

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

👍

@@ -1,7 +1,7 @@
export const baseFonts = {
fontFamily: `
-apple-system, ".SFNSText-Regular", "San Francisco", "Roboto",
"Segoe UI", "Helvetica Neue", "Lucida Grande", sans-serif
-apple-system, "BlinkMacSystemFont", ".SFNSText-Regular", "San Francisco", "Roboto",
Copy link
Member

Choose a reason for hiding this comment

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

I don't know if it's a good time to do this change, since there a lot of other places that use these fonts.. So it makes it a bit inconsistent..

Copy link
Member Author

Choose a reason for hiding this comment

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

Well we've discussed in slack in the context of menu items jumping when they go from bold to normal. I can extract it to a separate PR if needed

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, I remember.. IMO it's better to change all these fonts together.. even in concerns of a git history..


if (node.type === treeNodeTypes.NAMESPACE) {
return (
<MenuItem style={containerStyle} onClick={onClick} data-name={node.name}>
Copy link
Member

Choose a reason for hiding this comment

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

is data-name only for tests ?

Copy link
Member Author

Choose a reason for hiding this comment

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

Basically so

@Hypnosphi
Copy link
Member Author

Hypnosphi commented Jul 31, 2017

Speaking of the "too much blue" part, we need to indicate somehow that a particular menu item is a link. Stories and kinds are, namespaces aren't. We can replace blue with underlines, but I'm not sure we should.

At the same time, when some kind is already open, its link should be somehow marked as "active". If we just remove color, it becomes undistinguishable from namespace again. That's why bold is needed, but I'm open to other solutions.

@shilman, what do you think?

@Hypnosphi Hypnosphi requested a review from shilman August 1, 2017 17:04
@igor-dv igor-dv mentioned this pull request Aug 2, 2017
@Hypnosphi
Copy link
Member Author

Hypnosphi commented Aug 3, 2017

Maybe we should use links only for stories. In that case kinds wouldn't need to visually differ from namespaces
screen shot 2017-08-03 at 07 22 08

@Hypnosphi
Copy link
Member Author

How do you guys feel about adding indentation for stories by the way?
screen shot 2017-08-03 at 07 45 48

@igor-dv
Copy link
Member

igor-dv commented Aug 3, 2017

@Hypnosphi I like the idea to make stories only blue (or links). IMO selected story shouldn't became black.. maybe some shade of blue ? Indentations is too deep I think, but nice

Are there any designers in here 🆘 ?

@Hypnosphi
Copy link
Member Author

story shouldn't became black

Why? It's quite a standard way to mark link as 'active'

@shilman
Copy link
Member

shilman commented Aug 3, 2017

Here are my opinions on this stuff. Sorry for the slow turnaround @Hypnosphi @igor-dv:

  1. It's great to change things to links to make it easy to open up stories in other windows, accessibility, etc. 👍
  2. It's great to make a better visual distinction between "stories" and "kinds". 👍
  3. I don't think there necessarily needs to be a visual distinction between "folders" and "kinds" (they are all just groupings in the end). 👎
  4. I think the original indentation was fine. I think more indentation is not a good use of space, especially if we make a good visual distinction between stories and kinds. 👎
  5. I think the bright blue is pretty overwhelming. I'd like to come up with a better way to distinguish stories and kinds. Even the more subtle blue is pretty ... blue 👎

Hope that helps! 😀

@shilman
Copy link
Member

shilman commented Aug 3, 2017

Also to help with your blue/black debate, I submit this. Heheheh.

Personal preference is to keep the existing 3.2 look-and-feel and get another option ready to help distinguish stories and kinds, but I'm ok with subtle changes as long as we can revisit it soon.

Copy link
Member

@ndelangen ndelangen left a comment

Choose a reason for hiding this comment

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

screen shot 2017-08-03 at 07 45 48

My thoughts on these discussions:
✔️ better accessibility
✔️ blue
✔️ black=active
✔️ visual difference kind|story
❌ visual difference kind|group
✔️ added indentation

Screenshot is OK with me.

@shilman the dress is blue & gold

@Hypnosphi
Copy link
Member Author

I think the bright blue is pretty overwhelming

Well it's link color from our website

@Hypnosphi
Copy link
Member Author

@shilman @igor-dv @ndelangen
Can we maybe compromise on some minor indentation?
screen shot 2017-08-03 at 16 00 23

@Hypnosphi
Copy link
Member Author

As an alternative to color I can suggest slight underline:
screen shot 2017-08-03 at 16 12 35

@shilman
Copy link
Member

shilman commented Aug 3, 2017

I think the bright blue is pretty overwhelming

Well it's link color from our website

The website and Storybook are entirely different UI's. Just because it looks OK in one doesn't mean it looks OK in the other.

@Hypnosphi
Copy link
Member Author

I tried indigo from material palette
screen shot 2017-08-03 at 18 31 53

Copy link
Member

@shilman shilman left a comment

Choose a reason for hiding this comment

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

I'm sure this is tiring, but I'd like to propose that we split the PR into two:

  1. functional changes that i'm happy to merge/release today
  2. visual changes that are a lot more contentious

I have stronger thoughts about the visual side after consulting some designers, but i'd like to get the functional aspect of this merged and shipped

@Hypnosphi
Copy link
Member Author

Hypnosphi commented Aug 3, 2017

So, to be clear, you want to introduce black links without underline (for now)?

@Hypnosphi
Copy link
Member Author

Ok, so I've rebased the branch, and left only the functional changes plus some minor style adjustments needed for correct focus outline dispaying

Copy link
Member

@shilman shilman left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks for separating out the functional pieces. We'll come up with a good visual solution too!

@igor-dv igor-dv merged commit ab45a9b into storybookjs:master Aug 4, 2017
@Hypnosphi Hypnosphi deleted the menu-hrefs branch August 4, 2017 20:35
@ndelangen
Copy link
Member

🥇

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.

5 participants