Skip to content
This repository was archived by the owner on Mar 25, 2025. It is now read-only.

Commit 0a31bf2

Browse files
lekoafTigge
authored andcommitted
chore(docs): github repository link
Adds a menu link to the github repository. Also adds the ability to use icons for the menu choices and adds icons for Home and Changelog menu items.
1 parent 85272e7 commit 0a31bf2

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

packages/docs/src/Menu.tsx

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,31 @@ import {
66
ExpandableListItemType,
77
IconButton,
88
} from 'practical-react-components-core'
9-
import { HamburgerMenuIcon } from 'practical-react-components-icons'
9+
import {
10+
DownloadIcon,
11+
HamburgerMenuIcon,
12+
HomeIcon,
13+
LogIcon,
14+
} from 'practical-react-components-icons'
1015

1116
import { Components, Component } from './types'
1217

1318
const BASE_ITEMS = [
1419
{
1520
name: 'Home',
1621
route: '/',
22+
icon: HomeIcon,
23+
},
24+
{
25+
name: 'Repository',
26+
route: 'https://github.com/AxisCommunications/practical-react-components',
27+
icon: DownloadIcon,
1728
},
1829
{
1930
name: 'Changelog',
2031
route:
2132
'https://github.com/AxisCommunications/practical-react-components/blob/main/CHANGELOG.md',
33+
icon: LogIcon,
2234
},
2335
]
2436

@@ -83,7 +95,7 @@ export const Menu: React.FC<MenuProps> = ({ components }) => {
8395
[...BASE_ITEMS, ...components].map(c => ({
8496
id: c.name,
8597
label: c.name,
86-
icon: () => null,
98+
icon: () => c.icon ?? null,
8799
selected: matchPath(location.pathname, c.route) !== null,
88100
onClick: () =>
89101
/^https?:\/\//.test(c.route)

packages/docs/src/types.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1+
import { IconType } from 'practical-react-components-core'
2+
13
export interface Component {
24
readonly name: string
35
readonly route: string
46
readonly menu: string
7+
readonly icon?: IconType
58
readonly component: React.FC
69
}
710

0 commit comments

Comments
 (0)