Skip to content

Commit

Permalink
add icons to APP_ROUTES #10
Browse files Browse the repository at this point in the history
  • Loading branch information
DominikHorn committed Feb 28, 2020
1 parent c9ed65f commit a1d5099
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
import { createStyles, List, ListItem, ListItemText, makeStyles, SwipeableDrawer, Theme } from '@material-ui/core';
import {
createStyles,
List,
ListItem,
ListItemText,
makeStyles,
SwipeableDrawer,
Theme,
ListItemIcon,
} from '@material-ui/core';
import * as React from 'react';
import { Link } from 'react-router-dom';
import { APP_ROUTES, getLinkForRoute, getDisplayNameForRoute } from 'util/routes';
Expand Down Expand Up @@ -28,6 +37,7 @@ export const RouteDrawer = (props: RouteDrawerProps) => {
<List>
{APP_ROUTES.map(route => (
<ListItem button={true} key={getLinkForRoute(route)}>
{route.icon && <ListItemIcon>{route.icon}</ListItemIcon>}
<Link to={getLinkForRoute(route)}>
<ListItemText primary={getDisplayNameForRoute(route)} />
</Link>
Expand Down
5 changes: 3 additions & 2 deletions packages/types/src/routes/appRoute.type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@ export interface AppRoute extends RouteProps {
// link text (Human readable!)
readonly displayName?: string;

// optional icon displayed next to the link name
readonly icon?: JSX.Element;

// AppRoutes must have a path - deoptionalize this property
readonly path: AppPath;

render(props: any): any;
}

0 comments on commit a1d5099

Please sign in to comment.