-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixed wcag issue in ui-editor (#4517)
* fixed wcag issue in ui-editor Co-authored-by: Nina Kylstad <[email protected]> * updated snapshot * corrected identation * updated indents * changed indentation * fix remaining code smells * fix imports * fix failing test Co-authored-by: Nina Kylstad <[email protected]>
- Loading branch information
1 parent
e764da0
commit 8efa702
Showing
11 changed files
with
152 additions
and
89 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
80 changes: 80 additions & 0 deletions
80
src/studio/src/designer/frontend/shared/navigation/drawer/ListItemLink.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
import ListItem from '@material-ui/core/ListItem'; | ||
import ListItemIcon from '@material-ui/core/ListItemIcon'; | ||
import ListItemText from '@material-ui/core/ListItemText'; | ||
import { withStyles } from '@material-ui/core/styles'; | ||
import classNames from 'classnames'; | ||
import * as React from 'react'; | ||
import { Link as RouterLink, LinkProps as RouterLinkProps } from 'react-router-dom'; | ||
import AltinnIcon from '../../components/AltinnIcon'; | ||
import { IMenuItem } from './drawerMenuSettings'; | ||
import { styles } from './leftDrawerMenuStyles'; | ||
|
||
import altinnTheme from '../../theme/altinnStudioTheme'; | ||
|
||
export interface ListItemLinkProps { | ||
to: string; | ||
classes: any; | ||
menuItem: IMenuItem; | ||
index: number; | ||
activeLeftMenuSelection: boolean; | ||
onMouseEnterListItem: any; | ||
onMouseLeaveListItem: any; | ||
state: any; | ||
} | ||
|
||
function ListItemLink(props: ListItemLinkProps) { | ||
const { | ||
to, | ||
classes, | ||
index, | ||
menuItem, | ||
activeLeftMenuSelection, | ||
onMouseEnterListItem, | ||
onMouseLeaveListItem, | ||
state, | ||
} = props; | ||
const renderLink = React.useMemo( | ||
() => React.forwardRef<any, Omit<RouterLinkProps, 'to'>>((itemProps, ref) => ( | ||
<RouterLink | ||
to={to} | ||
ref={ref} | ||
// eslint-disable-next-line react/jsx-props-no-spreading | ||
{...itemProps} | ||
/>)), | ||
[to], | ||
); | ||
return ( | ||
<ListItem | ||
button={true} | ||
component={renderLink} | ||
classes={{ | ||
root: classNames(classes.listItem, | ||
{ | ||
[classes.activeListItem]: activeLeftMenuSelection, | ||
}), | ||
}} | ||
style={{ borderBottom: 0 }} | ||
onMouseEnter={onMouseEnterListItem} | ||
onMouseLeave={onMouseLeaveListItem} | ||
> | ||
|
||
<ListItemIcon> | ||
<AltinnIcon | ||
isActive={activeLeftMenuSelection} | ||
isActiveIconColor={altinnTheme.altinnPalette.primary.blueDark} | ||
iconClass={menuItem.iconClass} | ||
iconColor={state.iconColor[index] === undefined | ||
? 'rgba(0, 0, 0, 0.54)' : state.iconColor[index]} | ||
/> | ||
</ListItemIcon> | ||
<ListItemText | ||
disableTypography={true} | ||
primary={menuItem.displayText} | ||
classes={{ root: classNames(classes.listItemText) }} | ||
/> | ||
|
||
</ListItem> | ||
); | ||
} | ||
|
||
export default withStyles(styles)(ListItemLink); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters