@sikka/hawa 0.1.24 → 0.1.25
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/es/index.es.js +1 -1
- package/lib/index.js +1 -1
- package/package.json +1 -1
- package/src/layout/AppLayout.tsx +41 -42
package/package.json
CHANGED
package/src/layout/AppLayout.tsx
CHANGED
|
@@ -64,23 +64,41 @@ export const AppLayout: React.FunctionComponent<AppLayoutTypes> = ({
|
|
|
64
64
|
clickedItem,
|
|
65
65
|
...props
|
|
66
66
|
}) => {
|
|
67
|
-
|
|
68
|
-
|
|
67
|
+
let closeDrawerWidth = 56
|
|
68
|
+
let openDrawerWidth = 200
|
|
69
|
+
let drawerSizeStyle = {
|
|
70
|
+
opened: {
|
|
71
|
+
sm: "100",
|
|
72
|
+
md: openDrawerWidth,
|
|
73
|
+
lg: "250",
|
|
74
|
+
},
|
|
75
|
+
closed: {
|
|
76
|
+
sm: closeDrawerWidth,
|
|
77
|
+
md: closeDrawerWidth,
|
|
78
|
+
lg: closeDrawerWidth,
|
|
79
|
+
},
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
const ref = useRef(null)
|
|
83
|
+
const isRTL = direction === "rtl"
|
|
84
|
+
|
|
69
85
|
const [openedSidebarItem, setOpenedSidebarItem] = useState("")
|
|
70
|
-
const { isOpen, onClose, onOpen } = useDiscloser(false)
|
|
71
86
|
const [selectedItem, setSelectedItem] = useState(
|
|
72
87
|
currentPage ? currentPage : []
|
|
73
88
|
)
|
|
74
89
|
|
|
75
|
-
const [keepOpen, setKeepOpen] = useState(false)
|
|
76
|
-
const ref = useRef(null)
|
|
77
|
-
const isRTL = direction === "rtl"
|
|
78
90
|
let size
|
|
79
91
|
if (typeof window !== "undefined") {
|
|
80
92
|
size = useBreakpoint()
|
|
81
93
|
} else {
|
|
82
94
|
size = 1200
|
|
83
95
|
}
|
|
96
|
+
const [keepOpen, setKeepOpen] = useState(size > 600 ? true : false)
|
|
97
|
+
const [openSideMenu, setOpenSideMenu] = useState(size > 600 ? true : false)
|
|
98
|
+
|
|
99
|
+
let drawerSizeCondition =
|
|
100
|
+
size > 600 ? drawerSizeStyle[keepOpen ? "opened" : "closed"][drawerSize] : 0
|
|
101
|
+
|
|
84
102
|
useEffect(() => {
|
|
85
103
|
const handleClickOutside = (event) => {
|
|
86
104
|
if (ref.current && !ref.current.contains(event.target) && !keepOpen) {
|
|
@@ -93,29 +111,13 @@ export const AppLayout: React.FunctionComponent<AppLayoutTypes> = ({
|
|
|
93
111
|
}
|
|
94
112
|
}, [keepOpen])
|
|
95
113
|
|
|
96
|
-
let drawerDefaultStyle =
|
|
97
|
-
"fixed top-0 z-40 flex h-full flex-col justify-between overflow-x-clip bg-card transition-all"
|
|
98
|
-
//The width of the drawer when closed
|
|
99
|
-
let closeDrawerWidth = 56
|
|
100
|
-
//The width of the drawer when opened
|
|
101
|
-
let openDrawerWidth = 200
|
|
102
|
-
let drawerSizeStyle = {
|
|
103
|
-
opened: {
|
|
104
|
-
sm: "100",
|
|
105
|
-
md: openDrawerWidth,
|
|
106
|
-
lg: "250",
|
|
107
|
-
},
|
|
108
|
-
closed: {
|
|
109
|
-
sm: "56",
|
|
110
|
-
md: "56",
|
|
111
|
-
lg: "56",
|
|
112
|
-
},
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
let drawerSizeCondition =
|
|
116
|
-
size > 600 ? drawerSizeStyle[keepOpen ? "opened" : "closed"][drawerSize] : 0
|
|
117
114
|
return (
|
|
118
115
|
<div className="fixed left-0">
|
|
116
|
+
{/*
|
|
117
|
+
* ----------------------------------------------------------------------------------------------------
|
|
118
|
+
* Top Bar
|
|
119
|
+
* ----------------------------------------------------------------------------------------------------
|
|
120
|
+
*/}
|
|
119
121
|
{props.topBar && (
|
|
120
122
|
<div
|
|
121
123
|
className={clsx(
|
|
@@ -212,7 +214,18 @@ export const AppLayout: React.FunctionComponent<AppLayoutTypes> = ({
|
|
|
212
214
|
direction={isRTL ? "rtl" : "ltr"}
|
|
213
215
|
trigger={
|
|
214
216
|
<div className="relative h-8 w-8 cursor-pointer overflow-clip rounded ring-1 ring-primary/30 dark:bg-gray-600">
|
|
215
|
-
<
|
|
217
|
+
<svg
|
|
218
|
+
aria-aria-label="Avatar Icon"
|
|
219
|
+
className="absolute -left-1 h-10 w-10 text-gray-400"
|
|
220
|
+
fill="currentColor"
|
|
221
|
+
viewBox="0 0 20 20"
|
|
222
|
+
>
|
|
223
|
+
<path
|
|
224
|
+
fillRule="evenodd"
|
|
225
|
+
d="M10 9a3 3 0 100-6 3 3 0 000 6zm-7 9a7 7 0 1114 0H3z"
|
|
226
|
+
clipRule="evenodd"
|
|
227
|
+
></path>
|
|
228
|
+
</svg>
|
|
216
229
|
</div>
|
|
217
230
|
}
|
|
218
231
|
items={props.profileMenuItems}
|
|
@@ -433,17 +446,3 @@ export const AppLayout: React.FunctionComponent<AppLayoutTypes> = ({
|
|
|
433
446
|
</div>
|
|
434
447
|
)
|
|
435
448
|
}
|
|
436
|
-
|
|
437
|
-
const AvatarIcon = () => (
|
|
438
|
-
<svg
|
|
439
|
-
className="absolute -left-1 h-10 w-10 text-gray-400"
|
|
440
|
-
fill="currentColor"
|
|
441
|
-
viewBox="0 0 20 20"
|
|
442
|
-
>
|
|
443
|
-
<path
|
|
444
|
-
fillRule="evenodd"
|
|
445
|
-
d="M10 9a3 3 0 100-6 3 3 0 000 6zm-7 9a7 7 0 1114 0H3z"
|
|
446
|
-
clipRule="evenodd"
|
|
447
|
-
></path>
|
|
448
|
-
</svg>
|
|
449
|
-
)
|