-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
Conversation
@igor-dv mind taking a look at this? |
@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 |
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.
Let's review after the compatibility changes
@Hypnosphi Awesome!! Do you think you could resolve the merge conflicts? |
Those changes may be non-trivial to integrate with react-treebeard, but I'd give it a try |
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/ |
@Hypnosphi , look at |
@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 Report
@@ 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
Continue to review full report at Codecov.
|
@Hypnosphi LMK, when it's ready to review. |
@igor-dv I think it is |
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.
|
||
// 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; |
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.
extract 0
to some const for readability
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.
Will do
} | ||
|
||
render() { | ||
const { onClick, href, children, overrideParams, ...restProps } = this.props; |
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 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>
);
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.
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)
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.
Crap... those unused props are annoying me..
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.
plus we need explicit href
and children
to make eslint-plugin-jsx-a11y happy
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.
👍
@@ -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", |
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 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..
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.
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
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.
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}> |
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.
is data-name
only for tests ?
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.
Basically so
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 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 🆘 ? |
Why? It's quite a standard way to mark link as 'active' |
Here are my opinions on this stuff. Sorry for the slow turnaround @Hypnosphi @igor-dv:
Hope that helps! 😀 |
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. |
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.
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
Well it's link color from our website |
@shilman @igor-dv @ndelangen |
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. |
I tried indigo from material palette |
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 sure this is tiring, but I'd like to propose that we split the PR into two:
- functional changes that i'm happy to merge/release today
- 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
So, to be clear, you want to introduce black links without underline (for now)? |
Ok, so I've rebased the branch, and left only the functional changes plus some minor style adjustments needed for correct focus outline dispaying |
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.
LGTM! Thanks for separating out the functional pieces. We'll come up with a good visual solution too!
🥇 |
This improves UX by making it possible to open stories in new tab/window, copy links etc.