@campxdev/campx-web-utils 0.4.4 → 0.4.6

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
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@campxdev/campx-web-utils",
3
- "version": "0.4.4",
3
+ "version": "0.4.6",
4
4
  "main": "./export.ts",
5
5
  "private": false,
6
6
  "peerDependencies": {
7
- "@campxdev/react-blueprint": ">=1.7.4",
7
+ "@campxdev/react-blueprint": ">=1.7.9",
8
8
  "@emotion/react": ">=^11.13.3",
9
9
  "@emotion/styled": ">=^11.13.0",
10
10
  "@mui/icons-material": ">=6.1.5",
@@ -14,7 +14,7 @@
14
14
  "react-redux": "=>9.1.2"
15
15
  },
16
16
  "dependencies": {
17
- "@campxdev/react-blueprint": "1.7.4",
17
+ "@campxdev/react-blueprint": "1.7.9",
18
18
  "@hookform/resolvers": "^3.9.0",
19
19
  "@mui/x-date-pickers": "^7.22.1",
20
20
  "axios": "^1.7.2",
@@ -1,11 +1,12 @@
1
1
  import { AppHeader, Sidebar, Spinner } from '@campxdev/react-blueprint';
2
2
  import { SideMenuItemProps } from '@campxdev/react-blueprint/src/components/Navigation/Sidebar/Sidebar';
3
- import { Box, Stack, useTheme } from '@mui/material';
3
+ import { Box, Stack, styled, useMediaQuery, useTheme } from '@mui/material';
4
4
  import { motion } from 'framer-motion';
5
5
  import Cookies from 'js-cookie';
6
6
  import { Suspense, useState } from 'react';
7
7
  import { axios } from '../config/axios';
8
8
  import { ErrorBoundary } from '../context/export';
9
+ import { Margin } from '@mui/icons-material';
9
10
 
10
11
  interface Props {
11
12
  children?: React.ReactNode;
@@ -14,6 +15,7 @@ interface Props {
14
15
  handleLogout?: any;
15
16
  userName?: string;
16
17
  designation?: string;
18
+ clientName?: string;
17
19
  }
18
20
 
19
21
  export const AppLayout: React.FC<Props> = ({
@@ -23,9 +25,11 @@ export const AppLayout: React.FC<Props> = ({
23
25
  handleLogout,
24
26
  userName = '',
25
27
  designation = '',
28
+ clientName = 'Ohio State University',
26
29
  }) => {
27
30
  const [collapsed, setCollapsed] = useState(true);
28
31
  const theme = useTheme();
32
+ const isSmallScreen = useMediaQuery(theme.breakpoints.down('md'));
29
33
 
30
34
  function logout() {
31
35
  axios
@@ -42,10 +46,7 @@ export const AppLayout: React.FC<Props> = ({
42
46
  }
43
47
 
44
48
  return (
45
- <Stack
46
- sx={{ backgroundColor: theme.palette.surface.defaultBackground }}
47
- direction={'row'}
48
- >
49
+ <AppLayoutContainer>
49
50
  <Sidebar menu={menu} collapsed={collapsed} setCollapsed={setCollapsed} />
50
51
  <motion.div
51
52
  animate={{
@@ -54,50 +55,76 @@ export const AppLayout: React.FC<Props> = ({
54
55
  transition={{ duration: 0.3, ease: 'circOut' }}
55
56
  style={{
56
57
  margin: '12px 12px 12px 0px',
57
- width: 'calc(100% - 84px)',
58
+ width: isSmallScreen ? '100%' : 'calc(100% - 84px)',
59
+ display: isSmallScreen ? 'contents' : 'block',
58
60
  }}
59
61
  >
60
- <Stack gap="12px">
61
- <AppHeader
62
- actions={[]}
63
- collapsed={collapsed}
64
- showActiveDevices={false}
65
- onLogoutClick={handleLogout ?? logout}
66
- clientName={''}
67
- userFullName={userName}
68
- designation={designation}
69
- />
70
- <Box
71
- sx={{
72
- // backgroundColor: theme.palette.surface.paperBackground,
73
- borderRadius: '8px',
74
- height: 'calc(100vh - 96px)',
75
- overflowY: 'scroll',
76
- '&::-webkit-scrollbar': {
77
- width: '0.5em',
78
- height: '0.2em',
79
- },
62
+ <AppHeader
63
+ actions={[]}
64
+ collapsed={collapsed}
65
+ showActiveDevices={false}
66
+ onLogoutClick={handleLogout ?? logout}
67
+ clientName={''}
68
+ userFullName={userName}
69
+ designation={designation}
70
+ {...(isSmallScreen && {
71
+ profileSx: { width: 32, height: 32, fontSize: '12px' },
72
+ })}
73
+ />
74
+ <OuletContainer
75
+ sx={{
76
+ // backgroundColor: theme.palette.surface.paperBackground,
80
77
 
81
- '&::-webkit-scrollbar-thumb': {
82
- backgroundColor: theme.palette.primary.light,
83
- borderRadius: '3px',
84
-
85
- '&:hover': {
86
- backgroundColor: theme.palette.primary.main,
87
- },
88
- },
89
- ...mainContainerSx,
90
- }}
91
- onClick={() => {
92
- setCollapsed(true);
93
- }}
94
- >
95
- <Suspense fallback={<Spinner />}>
96
- <ErrorBoundary>{children}</ErrorBoundary>
97
- </Suspense>
98
- </Box>
99
- </Stack>
78
+ ...mainContainerSx,
79
+ }}
80
+ onClick={() => {
81
+ setCollapsed(true);
82
+ }}
83
+ >
84
+ <Suspense fallback={<Spinner />}>
85
+ <ErrorBoundary>{children}</ErrorBoundary>
86
+ </Suspense>
87
+ </OuletContainer>
100
88
  </motion.div>
101
- </Stack>
89
+ </AppLayoutContainer>
102
90
  );
103
91
  };
92
+
93
+ const AppLayoutContainer = styled(Stack)(({ theme }: { theme?: any }) => ({
94
+ flexDirection: 'row',
95
+ backgroundColor: theme.palette.surface.defaultBackground,
96
+
97
+ [theme.breakpoints.down('md')]: {
98
+ flexWrap: 'wrap',
99
+ },
100
+ }));
101
+
102
+ const OuletContainer = styled(Box)(({ theme }: { theme?: any }) => ({
103
+ borderRadius: '8px',
104
+ height: 'calc(100vh - 96px)',
105
+ overflowY: 'scroll',
106
+ width: '100%',
107
+
108
+ '&::-webkit-scrollbar': {
109
+ width: '0.5em',
110
+ height: '0.2em',
111
+ },
112
+
113
+ '&::-webkit-scrollbar-thumb': {
114
+ backgroundColor: theme.palette.primary.light,
115
+ borderRadius: '3px',
116
+
117
+ '&:hover': {
118
+ backgroundColor: theme.palette.primary.main,
119
+ },
120
+ },
121
+
122
+ [theme.breakpoints.down('md')]: {
123
+ margin: '0px 12px 12px 12px',
124
+ height: 'calc(100vh - 118px)',
125
+
126
+ '&::-webkit-scrollbar': {
127
+ display: 'none',
128
+ },
129
+ },
130
+ }));