-
Notifications
You must be signed in to change notification settings - Fork 7
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
Feature/sc 109316/fe pro dashboard accessibility fixes #899
Changes from 4 commits
3f59c2f
5f07efa
99c6026
d717182
463695a
11373c9
2ca74a6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,11 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`Button is a HTML button element exists 1`] = `<Button />`; | ||
exports[`Button is a HTML button element exists 1`] = ` | ||
<button | ||
data-icon="only" | ||
data-swarm-button="default" | ||
data-swarm-size="default" | ||
data-swarm-width="default" | ||
type="button" | ||
/> | ||
`; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
// eslint-disable no-undef | ||
import PropTypes from 'prop-types'; | ||
import * as React from 'react'; | ||
import cx from 'classnames'; | ||
|
@@ -240,7 +241,7 @@ export class Nav extends React.Component { | |
isNewNavsOrder={ | ||
isNewNavsOrder && (localeCode ? localeCode.includes('en') : false) | ||
} | ||
hasNewConnections={connections.hasNewConnections} | ||
hasNewConnections={connections && connections.hasNewConnections} | ||
/> | ||
) : ( | ||
<DropdownLoader label={dropdownLoaderLabel} /> | ||
|
@@ -282,7 +283,11 @@ export class Nav extends React.Component { | |
}; | ||
|
||
const getConnectionsIcon = () => ( | ||
<img className="proIcon" alt={connections.label} src={CONNECTIONS_ICON} /> | ||
<img | ||
className="proIcon" | ||
alt={connections && connections.label} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is it possible that connections can be There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yep it's possible cause on pro-web connections not implemented and I just try to fix issue for update a lib version, it's not a part of my work There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it should be removed when connections will be implemented on pro-web, but idk who deals with this There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see, it will fix the type error, but still will leave alt attribute blank. Why not to use ternary here? |
||
src={CONNECTIONS_ICON} | ||
/> | ||
); | ||
|
||
const getNotificationsIcon = () => { | ||
|
@@ -399,19 +404,20 @@ export class Nav extends React.Component { | |
linkClassName: 'navItemLink-pro', | ||
isTargetBlank: true, | ||
}, | ||
media.isAtMediumUp && { | ||
shrink: true, | ||
linkTo: connections.link, | ||
label: connections.label, | ||
labelClassName: 'navItem-label-pro', | ||
className: cx('navItem--connections', CLASS_AUTH_ITEM), | ||
linkClassName: 'navItemLink-pro', | ||
counterBadgeClassName: 'navItem--counterBadgeConnections', | ||
icon: getConnectionsIcon(), | ||
hasUpdates: connections.hasNewConnections > 0, | ||
updatesLabel: updatesLabel, | ||
onLinkClick: messages.onLinkClick, | ||
}, | ||
media.isAtMediumUp && | ||
!!connections && { | ||
shrink: true, | ||
linkTo: connections.link, | ||
label: connections.label, | ||
labelClassName: 'navItem-label-pro', | ||
className: cx('navItem--connections', CLASS_AUTH_ITEM), | ||
linkClassName: 'navItemLink-pro', | ||
counterBadgeClassName: 'navItem--counterBadgeConnections', | ||
icon: getConnectionsIcon(), | ||
hasUpdates: connections.hasNewConnections > 0, | ||
updatesLabel: updatesLabel, | ||
onLinkClick: messages.onLinkClick, | ||
}, | ||
{ | ||
shrink: true, | ||
linkTo: messages.link, | ||
|
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.
It's really hard to read multiple ternary operators in jsx and I surprised that it is allowed in eslint rules. Can we move it to a separate render function?
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.
it's just a copypast from swarm repo
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 have the same ternary above ) from 2019
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 it's a good chance to improve the code ;)