@admin-layout/gluestack-ui-mobile 6.5.1-alpha.0
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/CHANGELOG.md +117 -0
- package/LICENSE +21 -0
- package/README.md +4 -0
- package/assets/logo.png +0 -0
- package/babel.config.js +26 -0
- package/jest-react-navigation-setup.js +14 -0
- package/jest.config.js +39 -0
- package/jest.env.js +2 -0
- package/lib/__tests__/prolayout-layout-feature.test.d.ts +1 -0
- package/lib/__tests__/prolayout-layout-feature.test.js +202 -0
- package/lib/__tests__/prolayout-layout-feature.test.js.map +1 -0
- package/lib/components/ApplicationErrorFillWrapper.d.ts +2 -0
- package/lib/components/ApplicationErrorFillWrapper.js +7 -0
- package/lib/components/ApplicationErrorFillWrapper.js.map +1 -0
- package/lib/components/ApplicationErrorHandler.d.ts +2 -0
- package/lib/components/ApplicationErrorHandler.js +24 -0
- package/lib/components/ApplicationErrorHandler.js.map +1 -0
- package/lib/components/ErrorBounday.d.ts +18 -0
- package/lib/components/ErrorBounday.js +22 -0
- package/lib/components/ErrorBounday.js.map +1 -0
- package/lib/components/Fallback.d.ts +6 -0
- package/lib/components/Fallback.js +53 -0
- package/lib/components/Fallback.js.map +1 -0
- package/lib/components/Layout/components/BasicLayout.d.ts +5 -0
- package/lib/components/Layout/components/BasicLayout.js +28 -0
- package/lib/components/Layout/components/BasicLayout.js.map +1 -0
- package/lib/components/Layout/components/BottomTabBar.d.ts +2 -0
- package/lib/components/Layout/components/BottomTabBar.js +90 -0
- package/lib/components/Layout/components/BottomTabBar.js.map +1 -0
- package/lib/components/Layout/components/Drawer.d.ts +2 -0
- package/lib/components/Layout/components/Drawer.js +253 -0
- package/lib/components/Layout/components/Drawer.js.map +1 -0
- package/lib/components/Layout/components/Header.d.ts +2 -0
- package/lib/components/Layout/components/Header.js +130 -0
- package/lib/components/Layout/components/Header.js.map +1 -0
- package/lib/components/Layout/components/Sample.d.ts +2 -0
- package/lib/components/Layout/components/Sample.js +7 -0
- package/lib/components/Layout/components/Sample.js.map +1 -0
- package/lib/components/Layout/components/SettingDrawer/LayoutButton.d.ts +3 -0
- package/lib/components/Layout/components/SettingDrawer/LayoutButton.js +66 -0
- package/lib/components/Layout/components/SettingDrawer/LayoutButton.js.map +1 -0
- package/lib/components/Layout/components/SettingDrawer/SettingDrawer.d.ts +2 -0
- package/lib/components/Layout/components/SettingDrawer/SettingDrawer.js +23 -0
- package/lib/components/Layout/components/SettingDrawer/SettingDrawer.js.map +1 -0
- package/lib/components/Layout/components/SettingDrawer/ThemeColorButton.d.ts +3 -0
- package/lib/components/Layout/components/SettingDrawer/ThemeColorButton.js +24 -0
- package/lib/components/Layout/components/SettingDrawer/ThemeColorButton.js.map +1 -0
- package/lib/components/Layout/components/SettingDrawer/index.d.ts +1 -0
- package/lib/components/Layout/components/SettingDrawer/index.js +2 -0
- package/lib/components/Layout/components/SettingDrawer/index.js.map +1 -0
- package/lib/components/Layout/components/SideBar.d.ts +10 -0
- package/lib/components/Layout/components/SideBar.js +59 -0
- package/lib/components/Layout/components/SideBar.js.map +1 -0
- package/lib/components/Layout/components/defaultSettings.d.ts +4 -0
- package/lib/components/Layout/components/defaultSettings.js +16 -0
- package/lib/components/Layout/components/defaultSettings.js.map +1 -0
- package/lib/components/Layout/components/index.d.ts +4 -0
- package/lib/components/Layout/components/index.js +5 -0
- package/lib/components/Layout/components/index.js.map +1 -0
- package/lib/components/Layout/components/util.d.ts +1 -0
- package/lib/components/Layout/components/util.js +15 -0
- package/lib/components/Layout/components/util.js.map +1 -0
- package/lib/components/Layout/compute.d.ts +6 -0
- package/lib/components/Layout/compute.js +316 -0
- package/lib/components/Layout/compute.js.map +1 -0
- package/lib/components/Layout/compute.test.d.ts +6 -0
- package/lib/components/Layout/compute.test.js +120 -0
- package/lib/components/Layout/compute.test.js.map +1 -0
- package/lib/components/Layout/index.d.ts +4 -0
- package/lib/components/Layout/index.js +4 -0
- package/lib/components/Layout/index.js.map +1 -0
- package/lib/components/Layout/typings.d.ts +1 -0
- package/lib/components/Layout/typings.js +2 -0
- package/lib/components/Layout/typings.js.map +1 -0
- package/lib/components/NavigationComponent.d.ts +15 -0
- package/lib/components/NavigationComponent.js +120 -0
- package/lib/components/NavigationComponent.js.map +1 -0
- package/lib/components/PluginArea.d.ts +2 -0
- package/lib/components/PluginArea.js +8 -0
- package/lib/components/PluginArea.js.map +1 -0
- package/lib/components/ToastAlert.d.ts +12 -0
- package/lib/components/ToastAlert.js +17 -0
- package/lib/components/ToastAlert.js.map +1 -0
- package/lib/components/index.d.ts +9 -0
- package/lib/components/index.js +10 -0
- package/lib/components/index.js.map +1 -0
- package/lib/components/with-interactions-managed.d.ts +2 -0
- package/lib/components/with-interactions-managed.js +18 -0
- package/lib/components/with-interactions-managed.js.map +1 -0
- package/lib/config/config.d.ts +17 -0
- package/lib/config/config.js +18 -0
- package/lib/config/config.js.map +1 -0
- package/lib/config/index.d.ts +1 -0
- package/lib/config/index.js +2 -0
- package/lib/config/index.js.map +1 -0
- package/lib/constants/routes.d.ts +3 -0
- package/lib/constants/routes.js +5 -0
- package/lib/constants/routes.js.map +1 -0
- package/lib/containers/layout/BasicLayout.d.ts +7 -0
- package/lib/containers/layout/BasicLayout.js +36 -0
- package/lib/containers/layout/BasicLayout.js.map +1 -0
- package/lib/containers/layout/DrawerBottomNavigationConfig.d.ts +128 -0
- package/lib/containers/layout/DrawerBottomNavigationConfig.js +72 -0
- package/lib/containers/layout/DrawerBottomNavigationConfig.js.map +1 -0
- package/lib/containers/layout/DrawerConfig.d.ts +85 -0
- package/lib/containers/layout/DrawerConfig.js +48 -0
- package/lib/containers/layout/DrawerConfig.js.map +1 -0
- package/lib/containers/layout/Lifecycle.d.ts +13 -0
- package/lib/containers/layout/Lifecycle.js +18 -0
- package/lib/containers/layout/Lifecycle.js.map +1 -0
- package/lib/containers/layout/ProLayout.d.ts +5 -0
- package/lib/containers/layout/ProLayout.js +35 -0
- package/lib/containers/layout/ProLayout.js.map +1 -0
- package/lib/containers/layout/module.d.ts +5 -0
- package/lib/containers/layout/module.js +22 -0
- package/lib/containers/layout/module.js.map +1 -0
- package/lib/hooks/use-after-interactions.d.ts +6 -0
- package/lib/hooks/use-after-interactions.js +29 -0
- package/lib/hooks/use-after-interactions.js.map +1 -0
- package/lib/hooks/useIsReady.d.ts +2 -0
- package/lib/hooks/useIsReady.js +24 -0
- package/lib/hooks/useIsReady.js.map +1 -0
- package/lib/hooks/useLayoutSetting/index.d.ts +11 -0
- package/lib/hooks/useLayoutSetting/index.js +68 -0
- package/lib/hooks/useLayoutSetting/index.js.map +1 -0
- package/lib/index.d.ts +14 -0
- package/lib/index.js +26 -0
- package/lib/index.js.map +1 -0
- package/lib/interfaces/index.d.ts +1 -0
- package/lib/interfaces/index.js +2 -0
- package/lib/interfaces/index.js.map +1 -0
- package/lib/interfaces/settings.d.ts +4 -0
- package/lib/interfaces/settings.js +2 -0
- package/lib/interfaces/settings.js.map +1 -0
- package/lib/redux/settings.d.ts +80 -0
- package/lib/redux/settings.js +16 -0
- package/lib/redux/settings.js.map +1 -0
- package/lib/utils/ThemeColor.d.ts +8 -0
- package/lib/utils/ThemeColor.js +9 -0
- package/lib/utils/ThemeColor.js.map +1 -0
- package/lib/utils/routeConfigKeyReplace.d.ts +7 -0
- package/lib/utils/routeConfigKeyReplace.js +77 -0
- package/lib/utils/routeConfigKeyReplace.js.map +1 -0
- package/lib/utils/routeConfigKeyReplace.test.d.ts +1 -0
- package/lib/utils/routeConfigKeyReplace.test.js +102 -0
- package/lib/utils/routeConfigKeyReplace.test.js.map +1 -0
- package/package.json +40 -0
- package/src/__tests__/prolayout-layout-feature.test.tsx +207 -0
- package/src/components/ApplicationErrorFillWrapper.tsx +7 -0
- package/src/components/ApplicationErrorHandler.tsx +30 -0
- package/src/components/ErrorBounday.tsx +31 -0
- package/src/components/Fallback.tsx +65 -0
- package/src/components/Layout/README.md +11 -0
- package/src/components/Layout/components/BasicLayout.tsx +70 -0
- package/src/components/Layout/components/BottomTabBar.tsx +135 -0
- package/src/components/Layout/components/Drawer.tsx +412 -0
- package/src/components/Layout/components/Header.tsx +195 -0
- package/src/components/Layout/components/Sample.tsx +10 -0
- package/src/components/Layout/components/SettingDrawer/LayoutButton.tsx +102 -0
- package/src/components/Layout/components/SettingDrawer/SettingDrawer.tsx +60 -0
- package/src/components/Layout/components/SettingDrawer/ThemeColorButton.tsx +26 -0
- package/src/components/Layout/components/SettingDrawer/index.ts +1 -0
- package/src/components/Layout/components/SideBar.tsx +109 -0
- package/src/components/Layout/components/defaultSettings.ts +19 -0
- package/src/components/Layout/components/index.ts +4 -0
- package/src/components/Layout/components/util.ts +14 -0
- package/src/components/Layout/compute.test.tsx +129 -0
- package/src/components/Layout/compute.tsx +384 -0
- package/src/components/Layout/eslint.json +1 -0
- package/src/components/Layout/index.ts +5 -0
- package/src/components/Layout/typings.ts +1 -0
- package/src/components/NavigationComponent.tsx +154 -0
- package/src/components/PluginArea.tsx +11 -0
- package/src/components/ToastAlert.tsx +44 -0
- package/src/components/index.ts +9 -0
- package/src/components/with-interactions-managed.tsx +33 -0
- package/src/config/config.ts +17 -0
- package/src/config/index.ts +1 -0
- package/src/constants/routes.ts +3 -0
- package/src/containers/layout/BasicLayout.tsx +61 -0
- package/src/containers/layout/DrawerBottomNavigationConfig.tsx +85 -0
- package/src/containers/layout/DrawerConfig.tsx +59 -0
- package/src/containers/layout/Lifecycle.tsx +23 -0
- package/src/containers/layout/ProLayout.tsx +42 -0
- package/src/containers/layout/module.ts +24 -0
- package/src/hooks/use-after-interactions.ts +35 -0
- package/src/hooks/useIsReady.ts +31 -0
- package/src/hooks/useLayoutSetting/index.ts +99 -0
- package/src/index.ts +41 -0
- package/src/interfaces/index.ts +1 -0
- package/src/interfaces/settings.ts +5 -0
- package/src/redux/settings.ts +28 -0
- package/src/utils/ThemeColor.ts +9 -0
- package/src/utils/__snapshots__/routeConfigKeyReplace.test.ts.snap +117 -0
- package/src/utils/routeConfigKeyReplace.test.ts +114 -0
- package/src/utils/routeConfigKeyReplace.ts +74 -0
- package/tsconfig.json +37 -0
- package/types.d.ts +11 -0
- package/webpack.config.js +104 -0
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Box, Pressable, HStack, VStack, Text } from '@gluestack-ui/themed';
|
|
3
|
+
|
|
4
|
+
const LayoutButton = ({ color, onSettingChange, settings, bottom, mode, bottomOnly, bottomDrawer }: any) => {
|
|
5
|
+
return (
|
|
6
|
+
<Pressable
|
|
7
|
+
backgroundColor={'#f0f2f5'}
|
|
8
|
+
width={50}
|
|
9
|
+
height={50}
|
|
10
|
+
borderRadius={'$sm'}
|
|
11
|
+
mr={'$4'}
|
|
12
|
+
onPress={() => {
|
|
13
|
+
if (mode === 'style') {
|
|
14
|
+
let { navTheme, ...rest } = settings;
|
|
15
|
+
if (color === 'white') {
|
|
16
|
+
navTheme = 'light';
|
|
17
|
+
const newSettings = {
|
|
18
|
+
...rest,
|
|
19
|
+
navTheme,
|
|
20
|
+
};
|
|
21
|
+
onSettingChange(newSettings);
|
|
22
|
+
} else {
|
|
23
|
+
navTheme = 'dark';
|
|
24
|
+
const newSettings = {
|
|
25
|
+
...rest,
|
|
26
|
+
navTheme,
|
|
27
|
+
};
|
|
28
|
+
onSettingChange(newSettings);
|
|
29
|
+
}
|
|
30
|
+
} else {
|
|
31
|
+
let { layout, ...rest } = settings;
|
|
32
|
+
if (bottom) {
|
|
33
|
+
layout = 'mixSide';
|
|
34
|
+
const newSettings = {
|
|
35
|
+
...rest,
|
|
36
|
+
layout,
|
|
37
|
+
};
|
|
38
|
+
onSettingChange(newSettings);
|
|
39
|
+
} else if (bottomOnly) {
|
|
40
|
+
layout = 'bottom';
|
|
41
|
+
const newSettings = {
|
|
42
|
+
...rest,
|
|
43
|
+
layout,
|
|
44
|
+
};
|
|
45
|
+
onSettingChange(newSettings);
|
|
46
|
+
} else if (bottomDrawer) {
|
|
47
|
+
layout = 'bottomDrawer';
|
|
48
|
+
const newSettings = {
|
|
49
|
+
...rest,
|
|
50
|
+
layout,
|
|
51
|
+
};
|
|
52
|
+
onSettingChange(newSettings);
|
|
53
|
+
} else {
|
|
54
|
+
layout = 'side';
|
|
55
|
+
const newSettings = {
|
|
56
|
+
...rest,
|
|
57
|
+
layout,
|
|
58
|
+
};
|
|
59
|
+
onSettingChange(newSettings);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}}
|
|
63
|
+
>
|
|
64
|
+
<HStack>
|
|
65
|
+
<Box
|
|
66
|
+
backgroundColor={color}
|
|
67
|
+
height={bottomOnly ? '$0' : 50}
|
|
68
|
+
width={'28%'}
|
|
69
|
+
borderTopLeftRadius={'$sm'}
|
|
70
|
+
borderBottomLeftRadius={'$sm'}
|
|
71
|
+
/>
|
|
72
|
+
<VStack justifyContent={'space-between'}>
|
|
73
|
+
<Box height={15} width={36} backgroundColor={'$white'} borderTopRightRadius={'$sm'} />
|
|
74
|
+
{bottom ? (
|
|
75
|
+
<Box height={15} width={36} backgroundColor={'$black'} borderBottomRightRadius={'$sm'} />
|
|
76
|
+
) : null}
|
|
77
|
+
|
|
78
|
+
{bottomOnly ? (
|
|
79
|
+
<>
|
|
80
|
+
<Box height={15} width={'$0'} backgroundColor={'$white'} borderTopRightRadius={'$sm'} />
|
|
81
|
+
<Box height={15} width={49} backgroundColor={'$black'} />
|
|
82
|
+
</>
|
|
83
|
+
) : null}
|
|
84
|
+
|
|
85
|
+
{bottomDrawer ? (
|
|
86
|
+
<>
|
|
87
|
+
<Box
|
|
88
|
+
height={15}
|
|
89
|
+
width={36}
|
|
90
|
+
backgroundColor={'$black'}
|
|
91
|
+
borderBottomRightRadius={'$sm'}
|
|
92
|
+
/>
|
|
93
|
+
<Text></Text>
|
|
94
|
+
</>
|
|
95
|
+
) : null}
|
|
96
|
+
</VStack>
|
|
97
|
+
</HStack>
|
|
98
|
+
</Pressable>
|
|
99
|
+
);
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
export default LayoutButton;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {Box, Text, HStack} from '@gluestack-ui/themed';
|
|
3
|
+
import { useSelector } from 'react-redux';
|
|
4
|
+
|
|
5
|
+
import LayoutButton from './LayoutButton';
|
|
6
|
+
import ThemeColorButton from './ThemeColorButton';
|
|
7
|
+
import { THEMECOLOR } from '../../../../utils/ThemeColor';
|
|
8
|
+
|
|
9
|
+
export const SettingDrawer = ({ onSettingChange }: any) => {
|
|
10
|
+
const settings = useSelector<any>((state) => state.settings) as any;
|
|
11
|
+
return (
|
|
12
|
+
<Box position={'absolute'} flex={1} flexGrow={1} p={"$5"} right={"$0"} bg={'$white'} top={"$4"} >
|
|
13
|
+
<Text color={'#000080'} style={{fontWeight:'900'}}>
|
|
14
|
+
Page style setting
|
|
15
|
+
</Text>
|
|
16
|
+
<HStack space={"md"} mt={"$3"}>
|
|
17
|
+
<LayoutButton mode="style" settings={settings} onSettingChange={onSettingChange} color={'white'} />
|
|
18
|
+
<LayoutButton mode="style" settings={settings} onSettingChange={onSettingChange} color={'black'} />
|
|
19
|
+
</HStack>
|
|
20
|
+
<Text color={'#000080'} style={{fontWeight:'900'}} mt={"$2"}>
|
|
21
|
+
Theme Color
|
|
22
|
+
</Text>
|
|
23
|
+
<HStack space={"md"} mt={"$3"} flexWrap={'wrap'}>
|
|
24
|
+
{THEMECOLOR.map((color, index) => (
|
|
25
|
+
<ThemeColorButton key={index} color={color} settings={settings} onSettingChange={onSettingChange} />
|
|
26
|
+
))}
|
|
27
|
+
</HStack>
|
|
28
|
+
<Text color={'#000080'} style={{fontWeight:'900'}} mt={"$2"}>
|
|
29
|
+
Navigation Mode
|
|
30
|
+
</Text>
|
|
31
|
+
<HStack space={"md"} mt={"$3"}>
|
|
32
|
+
<LayoutButton mode="layout" settings={settings} onSettingChange={onSettingChange} color={'black'} />
|
|
33
|
+
<LayoutButton
|
|
34
|
+
mode="layout"
|
|
35
|
+
bottom={true}
|
|
36
|
+
settings={settings}
|
|
37
|
+
onSettingChange={onSettingChange}
|
|
38
|
+
color={'black'}
|
|
39
|
+
/>
|
|
40
|
+
|
|
41
|
+
<LayoutButton
|
|
42
|
+
mode="layout"
|
|
43
|
+
bottomOnly={true}
|
|
44
|
+
settings={settings}
|
|
45
|
+
onSettingChange={onSettingChange}
|
|
46
|
+
color={'black'}
|
|
47
|
+
/>
|
|
48
|
+
</HStack>
|
|
49
|
+
<HStack space={"md"} mt={"$3"}>
|
|
50
|
+
{/* <LayoutButton
|
|
51
|
+
mode="layout"
|
|
52
|
+
bottomDrawer={true}
|
|
53
|
+
settings={settings}
|
|
54
|
+
onSettingChange={onSettingChange}
|
|
55
|
+
color={'black'}
|
|
56
|
+
/> */}
|
|
57
|
+
</HStack>
|
|
58
|
+
</Box>
|
|
59
|
+
);
|
|
60
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Pressable, Box } from '@gluestack-ui/themed';
|
|
3
|
+
|
|
4
|
+
const ThemeColorButton = ({ color, onSettingChange, settings }: any) => {
|
|
5
|
+
return (
|
|
6
|
+
<Pressable
|
|
7
|
+
backgroundColor={color}
|
|
8
|
+
height={'$4'}
|
|
9
|
+
width={'$4'}
|
|
10
|
+
borderRadius={'$sm'}
|
|
11
|
+
onPress={() => {
|
|
12
|
+
let { primaryColor, ...rest } = settings;
|
|
13
|
+
primaryColor = color;
|
|
14
|
+
const newSettings = {
|
|
15
|
+
...rest,
|
|
16
|
+
primaryColor,
|
|
17
|
+
};
|
|
18
|
+
onSettingChange(newSettings);
|
|
19
|
+
}}
|
|
20
|
+
>
|
|
21
|
+
<Box />
|
|
22
|
+
</Pressable>
|
|
23
|
+
);
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export default ThemeColorButton;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './SettingDrawer';
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import { HStack, Icon, Text, Box, StatusBar, Divider, Button, FlatList, SafeAreaView } from '@gluestack-ui/themed';
|
|
3
|
+
import { StyleSheet, TouchableOpacity } from 'react-native';
|
|
4
|
+
import { Ionicons } from '@expo/vector-icons';
|
|
5
|
+
import { Link } from 'react-router-native';
|
|
6
|
+
import { useHistory } from 'react-router-native';
|
|
7
|
+
import { config } from '../../../config';
|
|
8
|
+
import { MenuDataItem } from '../typings';
|
|
9
|
+
import { COLOR } from '../../../utils/ThemeColor';
|
|
10
|
+
|
|
11
|
+
export interface SideBarProps {
|
|
12
|
+
menuData: MenuDataItem[];
|
|
13
|
+
matchUrl: string;
|
|
14
|
+
navTheme: string;
|
|
15
|
+
drawerRef: any;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const SideBar: React.FC<SideBarProps> = ({ menuData, matchUrl, navTheme, drawerRef }) => {
|
|
19
|
+
const [icon, setIcon] = useState('chevron-down-outline');
|
|
20
|
+
const [isToggle, setToggle] = useState(false);
|
|
21
|
+
const history = useHistory();
|
|
22
|
+
|
|
23
|
+
const toggle = () => {
|
|
24
|
+
if (isToggle) {
|
|
25
|
+
setIcon('chevron-down-outline');
|
|
26
|
+
setToggle(false);
|
|
27
|
+
} else {
|
|
28
|
+
setIcon('chevron-up-outline');
|
|
29
|
+
setToggle(true);
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
const isMenuExist = menuData.length > 0;
|
|
34
|
+
|
|
35
|
+
const openMenuItem = (menu) => {
|
|
36
|
+
history.push({ pathname: menu.path, state: menu.name });
|
|
37
|
+
drawerRef.current.closeDrawer();
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
return (
|
|
41
|
+
<Box flex={1} style={{ backgroundColor: navTheme === 'dark' ? COLOR.GREYISH_BLACK : COLOR.WHITE }}>
|
|
42
|
+
{!!isMenuExist && (
|
|
43
|
+
<FlatList
|
|
44
|
+
data={menuData}
|
|
45
|
+
renderItem={({ item }:any) => {
|
|
46
|
+
const keys = item?.key.split('.');
|
|
47
|
+
const arrowIcon:any = icon || 'chevron-down-outline';
|
|
48
|
+
return item?.routes ? (
|
|
49
|
+
<Box p={"$3"}>
|
|
50
|
+
<TouchableOpacity onPress={() => toggle()}>
|
|
51
|
+
<HStack>
|
|
52
|
+
<Ionicons
|
|
53
|
+
color={isToggle ? '#fff' : '#a1a1a1'}
|
|
54
|
+
name="document-outline"
|
|
55
|
+
/>
|
|
56
|
+
<Text style={{ color: isToggle ? '#fff' : '#a1a1a1' }}>{item.name}</Text>
|
|
57
|
+
<Ionicons name={arrowIcon} />
|
|
58
|
+
</HStack>
|
|
59
|
+
</TouchableOpacity>
|
|
60
|
+
{isToggle
|
|
61
|
+
? item.routes.map((subMenu: any) => (
|
|
62
|
+
<Box key={subMenu.key}>
|
|
63
|
+
<Link to={subMenu.path} underlayColor="#f0f4f7">
|
|
64
|
+
<Text style={{ color: '#a1a1a1' }}>{subMenu.name}</Text>
|
|
65
|
+
</Link>
|
|
66
|
+
</Box>
|
|
67
|
+
))
|
|
68
|
+
: null}
|
|
69
|
+
</Box>
|
|
70
|
+
) : (
|
|
71
|
+
keys[0] != 'Main' && keys[0] == 'sidebar' && (
|
|
72
|
+
<Box key={item.key} p={"$3"}>
|
|
73
|
+
<TouchableOpacity style={{ marginBottom: 10 }} onPress={() => openMenuItem(item)}>
|
|
74
|
+
<HStack>
|
|
75
|
+
<Ionicons
|
|
76
|
+
size={20}
|
|
77
|
+
color={navTheme === 'dark' ? COLOR.LIGHT_GREY : COLOR.BLACK}
|
|
78
|
+
name={item.icon}
|
|
79
|
+
/>
|
|
80
|
+
<Text
|
|
81
|
+
style={{
|
|
82
|
+
color: navTheme === 'dark' ? COLOR.LIGHT_GREY : COLOR.BLACK,
|
|
83
|
+
marginLeft: 10,
|
|
84
|
+
}}
|
|
85
|
+
>
|
|
86
|
+
{item.name}
|
|
87
|
+
</Text>
|
|
88
|
+
</HStack>
|
|
89
|
+
</TouchableOpacity>
|
|
90
|
+
<Divider />
|
|
91
|
+
</Box>
|
|
92
|
+
)
|
|
93
|
+
);
|
|
94
|
+
}}
|
|
95
|
+
/>
|
|
96
|
+
)}
|
|
97
|
+
</Box>
|
|
98
|
+
);
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
const styles = StyleSheet.create({
|
|
102
|
+
header: {
|
|
103
|
+
marginLeft: 20,
|
|
104
|
+
marginTop: 10,
|
|
105
|
+
marginBottom: 10,
|
|
106
|
+
},
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
export default SideBar;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { RenderSetting, ContentWidth, PureSettings, ProSettings } from '@admin-layout/client';
|
|
2
|
+
|
|
3
|
+
export { ContentWidth, PureSettings, RenderSetting, ProSettings };
|
|
4
|
+
|
|
5
|
+
const defaultSettings: ProSettings = {
|
|
6
|
+
navTheme: 'dark',
|
|
7
|
+
layout: 'side',
|
|
8
|
+
contentWidth: 'Fluid',
|
|
9
|
+
fixedHeader: false,
|
|
10
|
+
fixSiderbar: false,
|
|
11
|
+
menu: {
|
|
12
|
+
locale: false,
|
|
13
|
+
},
|
|
14
|
+
headerHeight: 48,
|
|
15
|
+
title: 'CDMBase LLC',
|
|
16
|
+
iconfontUrl: '',
|
|
17
|
+
primaryColor: '#1890ff',
|
|
18
|
+
};
|
|
19
|
+
export default defaultSettings;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/* eslint-disable import/no-extraneous-dependencies */
|
|
2
|
+
import { generatePath } from 'react-router';
|
|
3
|
+
|
|
4
|
+
export const generateMenuPath = (path, params) => {
|
|
5
|
+
try {
|
|
6
|
+
const generatedPath = generatePath(path, params);
|
|
7
|
+
return generatedPath;
|
|
8
|
+
} catch (err) {
|
|
9
|
+
console.log('--fillParams.path', path);
|
|
10
|
+
console.log('--fillParams.params', params);
|
|
11
|
+
console.log('generatePath is errored due to missing orgId');
|
|
12
|
+
}
|
|
13
|
+
return null;
|
|
14
|
+
};
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Feature } from '@common-stack/client-react';
|
|
3
|
+
import { createStackNavigator } from '@react-navigation/stack';
|
|
4
|
+
import { createDrawerNavigator } from '@react-navigation/drawer';
|
|
5
|
+
import { createBottomTabNavigator } from '@react-navigation/bottom-tabs';
|
|
6
|
+
|
|
7
|
+
const drawerConfig = (props=null as any) => {
|
|
8
|
+
return {
|
|
9
|
+
['//main_drawer']: {
|
|
10
|
+
exact: false,
|
|
11
|
+
container: createDrawerNavigator(),
|
|
12
|
+
name: 'MainDrawer',
|
|
13
|
+
props: {
|
|
14
|
+
initialRouteName: 'MainStack.MainDrawer.Home',
|
|
15
|
+
screenOptions: (options: any) => {
|
|
16
|
+
return {
|
|
17
|
+
headerShown: true,
|
|
18
|
+
drawerIcon: 'grid',
|
|
19
|
+
};
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
}};
|
|
24
|
+
|
|
25
|
+
const bottomTabConfig = {
|
|
26
|
+
['//bottom_tab']: {
|
|
27
|
+
container: createBottomTabNavigator(),
|
|
28
|
+
exact: false,
|
|
29
|
+
name: 'MainBottomTab',
|
|
30
|
+
props: {
|
|
31
|
+
initialRouteName: 'MainStack.MainBottomTab.Home',
|
|
32
|
+
screenOptions: ({ route }: any) => {
|
|
33
|
+
return {
|
|
34
|
+
headerShown: false,
|
|
35
|
+
title: 'Home',
|
|
36
|
+
headerTitle: 'Home',
|
|
37
|
+
tabBarActiveTintColor: '#4c87f9',
|
|
38
|
+
tabBarInactiveTintColor: 'black',
|
|
39
|
+
};
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
const hostBottomTabConfig = {
|
|
46
|
+
['//host_tab']: {
|
|
47
|
+
container: createBottomTabNavigator(),
|
|
48
|
+
exact: false,
|
|
49
|
+
name: 'HostTab',
|
|
50
|
+
props: {
|
|
51
|
+
initialRouteName: 'MainStack.HostTab.Booking',
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
const drawerBottomTabConfig = (props=null as any)=> {
|
|
57
|
+
return {
|
|
58
|
+
['//main_drawer']: {
|
|
59
|
+
exact: false,
|
|
60
|
+
container: createDrawerNavigator(),
|
|
61
|
+
name: 'MainDrawer',
|
|
62
|
+
props: {
|
|
63
|
+
initialRouteName: 'MainStack.MainDrawer.MainBottomTab',
|
|
64
|
+
screenOptions: (options: any) => {
|
|
65
|
+
return {
|
|
66
|
+
headerShown: false,
|
|
67
|
+
drawerIcon: 'grid',
|
|
68
|
+
};
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
['//main_drawer/bottom_tab']: {
|
|
73
|
+
container: createBottomTabNavigator(),
|
|
74
|
+
exact: false,
|
|
75
|
+
name: 'MainBottomTab',
|
|
76
|
+
props: {
|
|
77
|
+
initialRouteName: 'MainStack.MainDrawer.MainBottomTab.Home',
|
|
78
|
+
screenOptions: ({ route }: any) => {
|
|
79
|
+
return {
|
|
80
|
+
headerShown: true,
|
|
81
|
+
title: 'Home',
|
|
82
|
+
headerTitle: 'Home',
|
|
83
|
+
tabBarActiveTintColor: '#ff5a60',
|
|
84
|
+
tabBarInactiveTintColor: 'black',
|
|
85
|
+
};
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
},
|
|
89
|
+
}};
|
|
90
|
+
|
|
91
|
+
const bottomTabDrawerConfig = {
|
|
92
|
+
['//bottom_tab']: {
|
|
93
|
+
container: createBottomTabNavigator(),
|
|
94
|
+
exact: false,
|
|
95
|
+
name: 'MainBottomTab',
|
|
96
|
+
props: {
|
|
97
|
+
initialRouteName: 'MainStack.MainBottomTab.Home',
|
|
98
|
+
screenOptions: ({ route }: any) => {
|
|
99
|
+
return {
|
|
100
|
+
headerShown: false,
|
|
101
|
+
title: 'Home',
|
|
102
|
+
headerTitle: 'Home',
|
|
103
|
+
tabBarActiveTintColor: '#ff5a60',
|
|
104
|
+
tabBarInactiveTintColor: 'black',
|
|
105
|
+
};
|
|
106
|
+
},
|
|
107
|
+
},
|
|
108
|
+
},
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
export const appDrawerFeature = (props=null as any) => new Feature({
|
|
112
|
+
routeConfig: drawerConfig(props) as any,
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
export const appDrawerBottomTabFeature = (props=null as any) => new Feature({
|
|
116
|
+
routeConfig: drawerBottomTabConfig(props) as any,
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
export const appBottomTabFeature = new Feature({
|
|
120
|
+
routeConfig: bottomTabConfig as any,
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
export const appHostBottomTabFeature = new Feature({
|
|
124
|
+
routeConfig: hostBottomTabConfig as any,
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
export const appBottomTabDrawerFeature = new Feature({
|
|
128
|
+
routeConfig: bottomTabDrawerConfig as any,
|
|
129
|
+
});
|