|
1 | 1 | import React, { useMemo } from 'react' |
2 | 2 | import { createPortal } from 'react-dom' |
3 | 3 | import { RouteComponentProps } from 'react-router-dom' |
4 | | -import { Pivot, PivotItem, PivotLinkFormat, PivotLinkSize, getTheme } from 'office-ui-fabric-react' |
| 4 | +import { Stack, Pivot, PivotItem, PivotLinkFormat, PivotLinkSize, IconButton, getTheme } from 'office-ui-fabric-react' |
5 | 5 | import { useTranslation } from 'react-i18next' |
6 | 6 | import { useState } from 'states/stateProvider' |
7 | 7 | import { StateWithDispatch } from 'states/stateProvider/reducer' |
@@ -63,30 +63,44 @@ const Navbar = ({ |
63 | 63 | } |
64 | 64 |
|
65 | 65 | return ( |
66 | | - <Pivot |
67 | | - selectedKey={selectedKey} |
68 | | - onLinkClick={(pivotItem?: PivotItem) => { |
69 | | - if (pivotItem && pivotItem.props) { |
70 | | - const linkDesc = Object.getOwnPropertyDescriptor(pivotItem.props, 'data-link') |
71 | | - if (linkDesc && typeof linkDesc.value === 'string') { |
72 | | - history.push(linkDesc.value) |
| 66 | + <Stack horizontal horizontalAlign="space-between" verticalAlign="stretch"> |
| 67 | + <Pivot |
| 68 | + selectedKey={selectedKey} |
| 69 | + onLinkClick={(pivotItem?: PivotItem) => { |
| 70 | + if (pivotItem && pivotItem.props) { |
| 71 | + const linkDesc = Object.getOwnPropertyDescriptor(pivotItem.props, 'data-link') |
| 72 | + if (linkDesc && typeof linkDesc.value === 'string') { |
| 73 | + history.push(linkDesc.value) |
| 74 | + } |
73 | 75 | } |
74 | | - } |
75 | | - }} |
76 | | - headersOnly |
77 | | - linkFormat={PivotLinkFormat.tabs} |
78 | | - linkSize={PivotLinkSize.large} |
79 | | - styles={styles} |
80 | | - > |
81 | | - {pivotItems.map(pivotItem => ( |
82 | | - <PivotItem |
83 | | - headerText={t(pivotItem.name)} |
84 | | - itemKey={pivotItem.key} |
85 | | - key={pivotItem.key} |
86 | | - data-link={pivotItem.url} |
87 | | - /> |
88 | | - ))} |
89 | | - </Pivot> |
| 76 | + }} |
| 77 | + headersOnly |
| 78 | + linkFormat={PivotLinkFormat.tabs} |
| 79 | + linkSize={PivotLinkSize.large} |
| 80 | + styles={styles} |
| 81 | + > |
| 82 | + {pivotItems.map(pivotItem => ( |
| 83 | + <PivotItem |
| 84 | + headerText={t(pivotItem.name)} |
| 85 | + itemKey={pivotItem.key} |
| 86 | + key={pivotItem.key} |
| 87 | + data-link={pivotItem.url} |
| 88 | + /> |
| 89 | + ))} |
| 90 | + </Pivot> |
| 91 | + <IconButton |
| 92 | + iconProps={{ iconName: 'Settings' }} |
| 93 | + onClick={() => history.push(Routes.SettingsGeneral)} |
| 94 | + styles={{ |
| 95 | + root: { |
| 96 | + height: 'auto', |
| 97 | + }, |
| 98 | + icon: { |
| 99 | + height: '20px', |
| 100 | + }, |
| 101 | + }} |
| 102 | + /> |
| 103 | + </Stack> |
90 | 104 | ) |
91 | 105 | } |
92 | 106 |
|
|
0 commit comments