wcz-layout 5.2.0 → 5.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "wcz-layout",
3
3
  "license": "MIT",
4
4
  "author": "Dalibor Homola",
5
- "version": "5.2.0",
5
+ "version": "5.2.2",
6
6
  "main": "dist/src/index.js",
7
7
  "module": "dist/src/index.js",
8
8
  "exports": {
@@ -3,7 +3,7 @@ import { AppBar as MuiAppBar, AppBarProps as MuiAppBarProps, Box, Chip, CssBasel
3
3
  import { csCZ, enUS } from '@mui/material/locale';
4
4
  import { createTheme, styled, ThemeProvider } from '@mui/material/styles';
5
5
  import { useIsFetching, useIsMutating } from '@tanstack/react-query';
6
- import React, { Fragment, useCallback, useEffect, useState } from 'react';
6
+ import React, { useCallback, useEffect, useState } from 'react';
7
7
  import { useTranslation } from 'react-i18next';
8
8
  import { useLocation } from 'react-router-dom';
9
9
  import { LeftDrawerItem } from '../models/LeftDrawerItem';
@@ -96,26 +96,17 @@ export default function Layout(props: LayoutProps) {
96
96
 
97
97
  return (
98
98
  <ThemeProvider theme={theme}>
99
- <Box sx={{ display: 'flex', position: "sticky" }}>
99
+ <Box sx={{ display: 'flex', position: 'sticky' }}>
100
100
  <CssBaseline />
101
101
  <AppBar position="fixed" open={leftDrawerOpen}>
102
102
  <Toolbar>
103
- <IconButton color="inherit" onClick={toggleDrawerOpen} edge="start" sx={{ marginRight: 2, ...(leftDrawerOpen && { display: 'none' }) }}>
103
+ <IconButton color="inherit" aria-label="menu" name="menu" onClick={toggleDrawerOpen} edge="start" sx={{ marginRight: 2, ...(leftDrawerOpen && { display: 'none' }) }} >
104
104
  <Menu />
105
105
  </IconButton>
106
106
 
107
107
  <Typography variant="h6" noWrap component="div" sx={{ flexGrow: 1 }}>{title}</Typography>
108
108
 
109
- {isDevelopment &&
110
- <Chip color="secondary" sx={{ mr: 1.5 }}
111
- label={
112
- <Fragment>
113
- <Typography sx={{ display: { xs: 'none', sm: 'block' } }}>Development</Typography>
114
- <Typography sx={{ display: { xs: 'block', sm: 'none' } }}>QAS</Typography>
115
- </Fragment>
116
- }
117
- />
118
- }
109
+ {isDevelopment && <Chip color="secondary" sx={{ mr: 1.5 }} label="Development" />}
119
110
 
120
111
  <AccountMenu mode={mode} setMode={setMode} user={user} />
121
112
  </Toolbar>
@@ -123,7 +114,7 @@ export default function Layout(props: LayoutProps) {
123
114
 
124
115
  <LeftDrawer appVersion={appVersion} items={leftDrawerItems} drawerOpen={leftDrawerOpen} setDrawerOpen={setLeftDrawerOpen} />
125
116
 
126
- <Box component="main" sx={{ flexGrow: 1 }}>
117
+ <Box component="main" sx={{ flex: 1, overflow: "auto" }}>
127
118
  <DrawerHeader />
128
119
  {authorized ? children : <CenteredBox label={t("Layout.Unauthorized")!} />}
129
120
  </Box>
@@ -115,7 +115,7 @@ export default function AccountMenu(props: AccountMenuProps) {
115
115
 
116
116
  return (
117
117
  <Fragment>
118
- <IconButton onClick={openMenu} color="inherit" aria-label="open app settings" edge="end" ref={accountButtonElement}>
118
+ <IconButton color="inherit" aria-label="account" name="account" onClick={openMenu} edge="end" ref={accountButtonElement}>
119
119
  {user.name ?
120
120
  <Avatar sx={{ bgcolor: 'white', color: grey[800], width: 32, height: 32, }}>
121
121
  <Typography variant="subtitle2" sx={{ fontWeight: 'bold', lineHeight: 0 }}>
@@ -1,5 +1,5 @@
1
1
  import { ChevronLeft, ChevronRight } from '@mui/icons-material';
2
- import { Box, Divider, Drawer as MuiDrawer, IconButton, List, ListItem, ListItemIcon, ListItemText, SwipeableDrawer, Typography } from '@mui/material';
2
+ import { Box, Divider, Drawer as MuiDrawer, IconButton, List, ListItem, ListItemButton, ListItemIcon, ListItemText, SwipeableDrawer, Typography } from '@mui/material';
3
3
  import { CSSObject, styled, Theme, useTheme } from '@mui/material/styles';
4
4
  import { Fragment, useCallback, useMemo } from 'react';
5
5
  import { useTranslation } from 'react-i18next';
@@ -84,11 +84,13 @@ export default function LeftDrawer(props: LeftDrawerProps) {
84
84
  const menuItems = (
85
85
  <List>
86
86
  {items.filter(item => !item.hidden).map(item =>
87
- <ListItem key={item.path} button selected={location.pathname === item.path} onClick={handleMenuItemClick(item.path)}>
88
- <ListItemIcon>
89
- {item.icon}
90
- </ListItemIcon>
91
- <ListItemText primary={t(item.title)} />
87
+ <ListItem key={item.path} disablePadding sx={{ display: 'block' }} onClick={handleMenuItemClick(item.path)}>
88
+ <ListItemButton selected={location.pathname === item.path} >
89
+ <ListItemIcon>
90
+ {item.icon}
91
+ </ListItemIcon>
92
+ <ListItemText primary={t(item.title)} />
93
+ </ListItemButton>
92
94
  </ListItem>
93
95
  )}
94
96
  </List>