@sikka/hawa 0.0.138 → 0.0.140
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/dist/styles.css +3 -0
- package/es/index.es.js +1 -1
- package/lib/index.js +1 -1
- package/package.json +1 -1
- package/src/elements/HawaMenu.tsx +1 -1
- package/src/elements/HawaStats.tsx +3 -3
- package/src/hooks/useBreakpoint.ts +4 -4
- package/src/layout/HawaAppLayout.tsx +37 -8
- package/src/styles.css +3 -0
- package/storybook-static/745.4b81597c.iframe.bundle.js +1 -0
- package/storybook-static/{767.232e4e4c88bb0a2ed02d.manager.bundle.js → 767.7ed51dff3faa8acf55cd.manager.bundle.js} +2 -2
- package/storybook-static/{767.232e4e4c88bb0a2ed02d.manager.bundle.js.LICENSE.txt → 767.7ed51dff3faa8acf55cd.manager.bundle.js.LICENSE.txt} +22 -19
- package/storybook-static/870.91cc9366.iframe.bundle.js +2 -0
- package/storybook-static/{103.af0e0958.iframe.bundle.js.LICENSE.txt → 870.91cc9366.iframe.bundle.js.LICENSE.txt} +15 -11
- package/storybook-static/iframe.html +1 -1
- package/storybook-static/index.html +1 -1
- package/storybook-static/{main.18ef859c.iframe.bundle.js → main.ad68749b.iframe.bundle.js} +1 -1
- package/storybook-static/project.json +1 -1
- package/storybook-static/runtime~main.0d980255.iframe.bundle.js +1 -0
- package/storybook-static/103.af0e0958.iframe.bundle.js +0 -2
- package/storybook-static/runtime~main.4a2964ac.iframe.bundle.js +0 -1
package/package.json
CHANGED
|
@@ -102,7 +102,7 @@ export const HawaMenu: React.FunctionComponent<TMenuTypes> = ({
|
|
|
102
102
|
: "mx-1 flex cursor-pointer flex-row items-center rounded-lg py-2 px-4 hover:bg-gray-200 rtl:flex-row-reverse dark:hover:bg-gray-600 dark:hover:text-white"
|
|
103
103
|
}
|
|
104
104
|
>
|
|
105
|
-
{
|
|
105
|
+
{item.icon && (
|
|
106
106
|
<div className="mr-2 rtl:ml-2">{item.icon}</div>
|
|
107
107
|
)}
|
|
108
108
|
{item.label}
|
|
@@ -11,11 +11,11 @@ type StatTypes = {
|
|
|
11
11
|
handleClick?: () => void
|
|
12
12
|
}
|
|
13
13
|
export const HawaStats: React.FunctionComponent<StatTypes> = (props) => {
|
|
14
|
-
let defaultStyle =
|
|
14
|
+
let defaultStyle =
|
|
15
|
+
"flex flex-col gap-1 rounded-lg p-4 text-sm h-fit max-h-fit"
|
|
15
16
|
let statStyles = {
|
|
16
17
|
plain: "",
|
|
17
18
|
contained: "bg-primary-200 w-fit",
|
|
18
|
-
// outlined: "border-2 border-primary-200 w-fit",
|
|
19
19
|
outlined: "ring-2 w-fit",
|
|
20
20
|
}
|
|
21
21
|
return (
|
|
@@ -29,7 +29,7 @@ export const HawaStats: React.FunctionComponent<StatTypes> = (props) => {
|
|
|
29
29
|
) : (
|
|
30
30
|
<div className="text-2xl font-bold">{props.number}</div>
|
|
31
31
|
)}{" "}
|
|
32
|
-
<div className="text-xs">{props.helperText}</div>
|
|
32
|
+
{props.helperText && <div className="text-xs">{props.helperText}</div>}{" "}
|
|
33
33
|
</div>
|
|
34
34
|
)
|
|
35
35
|
}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { useState, useEffect } from "react"
|
|
2
2
|
|
|
3
3
|
const useBreakpoint = () => {
|
|
4
|
-
const [breakpoint, setBreakpoint] = useState(
|
|
4
|
+
const [breakpoint, setBreakpoint] = useState(window?.innerWidth)
|
|
5
5
|
const resize = () => {
|
|
6
|
-
setBreakpoint(window
|
|
6
|
+
setBreakpoint(window?.innerWidth)
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
useEffect(() => {
|
|
10
|
-
window
|
|
10
|
+
window?.addEventListener("resize", resize)
|
|
11
11
|
|
|
12
12
|
return () => {
|
|
13
|
-
window
|
|
13
|
+
window?.removeEventListener("resize", resize)
|
|
14
14
|
}
|
|
15
15
|
}, [])
|
|
16
16
|
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import clsx from "clsx"
|
|
2
|
-
import React, { useState } from "react"
|
|
2
|
+
import React, { useEffect, useRef, useState } from "react"
|
|
3
3
|
import useDiscloser from "../hooks/useDiscloser"
|
|
4
4
|
import { HawaMenu } from "../elements"
|
|
5
|
-
|
|
5
|
+
import { HiMenu } from "react-icons/hi"
|
|
6
|
+
import useBreakpoint from "../hooks/useBreakpoint"
|
|
6
7
|
type HawaAppLayoutTypes = {
|
|
7
8
|
drawerItems: { label: string; icon: any; slug: string; action: () => void }[]
|
|
8
9
|
currentPage: string
|
|
@@ -28,19 +29,42 @@ export const HawaAppLayout: React.FunctionComponent<HawaAppLayoutTypes> = (
|
|
|
28
29
|
) => {
|
|
29
30
|
const [openSideMenu, setOpenSideMenu] = useState(false)
|
|
30
31
|
const { isOpen, onClose, onOpen } = useDiscloser(false)
|
|
32
|
+
const ref = useRef(null)
|
|
33
|
+
|
|
34
|
+
const size = useBreakpoint()
|
|
35
|
+
console.log("size is ", size)
|
|
36
|
+
useEffect(() => {
|
|
37
|
+
const handleClickOutside = (event) => {
|
|
38
|
+
if (ref.current && !ref.current.contains(event.target)) {
|
|
39
|
+
// onClickOutside && onClickOutside()
|
|
40
|
+
setOpenSideMenu(false)
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
document.addEventListener("click", handleClickOutside, true)
|
|
44
|
+
return () => {
|
|
45
|
+
document.removeEventListener("click", handleClickOutside, true)
|
|
46
|
+
}
|
|
47
|
+
}, [])
|
|
31
48
|
|
|
32
49
|
return (
|
|
33
50
|
<>
|
|
34
51
|
{props.topBar && (
|
|
35
52
|
<div
|
|
36
53
|
className={clsx(
|
|
37
|
-
"fixed top-0 z-40 flex h-14
|
|
38
|
-
"w-[calc(100%-3rem)]",
|
|
39
|
-
"translate-x-[3rem]",
|
|
54
|
+
"fixed top-0 z-40 flex h-14 flex-row items-center justify-between bg-primary-400",
|
|
55
|
+
size > 600 ? "w-[calc(100%-3rem)] translate-x-[3rem]" : "w-full",
|
|
40
56
|
"p-2",
|
|
41
57
|
"pr-5"
|
|
42
58
|
)}
|
|
43
59
|
>
|
|
60
|
+
{size > 600 ? null : (
|
|
61
|
+
<div
|
|
62
|
+
onClick={() => setOpenSideMenu(true)}
|
|
63
|
+
className=" cursor-pointer rounded-lg p-2 transition-all hover:bg-gray-100"
|
|
64
|
+
>
|
|
65
|
+
<HiMenu size={30} />
|
|
66
|
+
</div>
|
|
67
|
+
)}
|
|
44
68
|
{props.pageTitle ? <div>{props.pageTitle}</div> : <div></div>}
|
|
45
69
|
<HawaMenu
|
|
46
70
|
buttonPosition="top-right"
|
|
@@ -69,10 +93,14 @@ export const HawaAppLayout: React.FunctionComponent<HawaAppLayoutTypes> = (
|
|
|
69
93
|
<div
|
|
70
94
|
onMouseEnter={() => setOpenSideMenu(true)}
|
|
71
95
|
onMouseLeave={() => setOpenSideMenu(false)}
|
|
72
|
-
|
|
96
|
+
ref={ref}
|
|
97
|
+
className={clsx(
|
|
98
|
+
"fixed top-0 left-0 z-50 flex h-full flex-col overflow-auto bg-primary-400 transition-all hover:w-40",
|
|
99
|
+
size > 600 ? "w-12" : "w-0",
|
|
100
|
+
openSideMenu ? "w-40" : ""
|
|
101
|
+
)}
|
|
73
102
|
>
|
|
74
|
-
<div className="flex flex-row p-2">
|
|
75
|
-
{/* full logo */}
|
|
103
|
+
<div className="flex flex-row items-center justify-center bg-red-300 p-2">
|
|
76
104
|
{openSideMenu ? (
|
|
77
105
|
<img
|
|
78
106
|
className={clsx("h-10", !openSideMenu ? "invisible" : "visible")}
|
|
@@ -85,6 +113,7 @@ export const HawaAppLayout: React.FunctionComponent<HawaAppLayoutTypes> = (
|
|
|
85
113
|
/>
|
|
86
114
|
)}
|
|
87
115
|
</div>
|
|
116
|
+
|
|
88
117
|
{props.drawerItems.map((dSection, j) => (
|
|
89
118
|
<div className="flex flex-col items-stretch justify-center">
|
|
90
119
|
{dSection.map((dItem, i) => {
|
package/src/styles.css
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(self.webpackChunk_sikka_hawa=self.webpackChunk_sikka_hawa||[]).push([[745],{"./node_modules/react-dom/client.js":(__unused_webpack_module,exports,__webpack_require__)=>{var m=__webpack_require__("./node_modules/react-dom/index.js");exports.createRoot=m.createRoot,exports.hydrateRoot=m.hydrateRoot}}]);
|