@sikka/hawa 0.0.114 → 0.0.116
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 +52 -14
- package/es/elements/HawaAlert.d.ts +1 -0
- package/es/elements/HawaChip.d.ts +1 -1
- package/es/elements/HawaPinInput.d.ts +8 -0
- package/es/elements/HawaStats.d.ts +9 -0
- package/es/elements/index.d.ts +2 -0
- package/es/index.es.js +1 -1
- package/es/layout/HawaAppLayout.d.ts +9 -0
- package/es/layout/{HawaLayout.d.ts → HawaSiteLayout.d.ts} +1 -1
- package/es/layout/index.d.ts +2 -1
- package/lib/elements/HawaAlert.d.ts +1 -0
- package/lib/elements/HawaChip.d.ts +1 -1
- package/lib/elements/HawaPinInput.d.ts +8 -0
- package/lib/elements/HawaStats.d.ts +9 -0
- package/lib/elements/index.d.ts +2 -0
- package/lib/index.js +1 -1
- package/lib/layout/HawaAppLayout.d.ts +9 -0
- package/lib/layout/{HawaLayout.d.ts → HawaSiteLayout.d.ts} +1 -1
- package/lib/layout/index.d.ts +2 -1
- package/package.json +1 -2
- package/src/elements/HawaAlert.tsx +59 -2
- package/src/elements/HawaChip.tsx +1 -1
- package/src/elements/HawaPinInput.tsx +55 -0
- package/src/elements/HawaStats.tsx +25 -0
- package/src/elements/HawaTextField.tsx +4 -4
- package/src/elements/index.ts +2 -0
- package/src/layout/HawaAppLayout.tsx +60 -0
- package/src/layout/HawaSiteLayout.tsx +302 -0
- package/src/layout/index.ts +6 -6
- package/src/styles.css +52 -14
- package/storybook-static/51.786e9bbba427ee454dc0.manager.bundle.js +2 -0
- package/storybook-static/{51.8ca217c6882b6d3971a8.manager.bundle.js.LICENSE.txt → 51.786e9bbba427ee454dc0.manager.bundle.js.LICENSE.txt} +0 -0
- package/storybook-static/51.acbbdb95.iframe.bundle.js +2 -0
- package/storybook-static/{51.aeae4f67.iframe.bundle.js.LICENSE.txt → 51.acbbdb95.iframe.bundle.js.LICENSE.txt} +0 -0
- package/storybook-static/733.b57425fc.iframe.bundle.js +2 -0
- package/storybook-static/{669.31ae8ecc.iframe.bundle.js.LICENSE.txt → 733.b57425fc.iframe.bundle.js.LICENSE.txt} +0 -0
- package/storybook-static/767.2f9c96fa3338c8d16078.manager.bundle.js +2 -0
- package/storybook-static/{767.294896b3de4a98c7bd38.manager.bundle.js.LICENSE.txt → 767.2f9c96fa3338c8d16078.manager.bundle.js.LICENSE.txt} +0 -0
- package/storybook-static/iframe.html +1 -1
- package/storybook-static/index.html +2 -2
- package/storybook-static/main.4c317f06.iframe.bundle.js +1 -0
- package/storybook-static/project.json +1 -1
- package/storybook-static/{runtime~main.118c8621e276a271ad89.manager.bundle.js → runtime~main.25eae181fe0f96887a15.manager.bundle.js} +1 -1
- package/storybook-static/{runtime~main.4a2964ac.iframe.bundle.js → runtime~main.4d0bf318.iframe.bundle.js} +1 -1
- package/src/layout/HawaLayout.tsx +0 -212
- package/storybook-static/51.8ca217c6882b6d3971a8.manager.bundle.js +0 -2
- package/storybook-static/51.aeae4f67.iframe.bundle.js +0 -2
- package/storybook-static/669.31ae8ecc.iframe.bundle.js +0 -2
- package/storybook-static/767.294896b3de4a98c7bd38.manager.bundle.js +0 -2
- package/storybook-static/main.5ddcc678.iframe.bundle.js +0 -1
package/lib/layout/index.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sikka/hawa",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.116",
|
|
4
4
|
"description": "UI Kit",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "es/index.es.js",
|
|
@@ -38,7 +38,6 @@
|
|
|
38
38
|
"babel-loader": "^8.2.2",
|
|
39
39
|
"clsx": "^1.2.1",
|
|
40
40
|
"crypto-js": "^4.1.1",
|
|
41
|
-
"emotion-theming": "^11.0.0",
|
|
42
41
|
"framer-motion": "^4.1.7",
|
|
43
42
|
"html-webpack-plugin": "^5.5.0",
|
|
44
43
|
"next-scripts": "^0.3.4",
|
|
@@ -12,6 +12,13 @@ let severities = {
|
|
|
12
12
|
type AlertTypes = {
|
|
13
13
|
severity: keyof typeof severities
|
|
14
14
|
title?: any
|
|
15
|
+
variant?:
|
|
16
|
+
| "normal"
|
|
17
|
+
| "solid"
|
|
18
|
+
| "top-accent"
|
|
19
|
+
| "left-accent"
|
|
20
|
+
| "right-accent"
|
|
21
|
+
| "bottom-accent"
|
|
15
22
|
text: any
|
|
16
23
|
hideIcon?: any
|
|
17
24
|
actions?: [
|
|
@@ -22,12 +29,62 @@ type AlertTypes = {
|
|
|
22
29
|
}
|
|
23
30
|
]
|
|
24
31
|
}
|
|
25
|
-
export const HawaAlert: React.FunctionComponent<AlertTypes> = (
|
|
32
|
+
export const HawaAlert: React.FunctionComponent<AlertTypes> = ({
|
|
33
|
+
variant = "normal",
|
|
34
|
+
...props
|
|
35
|
+
}) => {
|
|
36
|
+
let styleVariant = {
|
|
37
|
+
normal: {
|
|
38
|
+
info: "text-blue-700 bg-blue-100 dark:bg-blue-200 dark:text-blue-800",
|
|
39
|
+
warning:
|
|
40
|
+
"text-yellow-700 bg-yellow-100 dark:bg-yellow-200 dark:text-yellow-800",
|
|
41
|
+
error: "text-red-700 bg-red-100 dark:bg-red-200 dark:text-red-800",
|
|
42
|
+
success:
|
|
43
|
+
"text-green-700 bg-green-100 dark:bg-green-200 dark:text-green-800",
|
|
44
|
+
},
|
|
45
|
+
"top-accent": {
|
|
46
|
+
info: "border-t-4 border-blue-300 text-blue-700 bg-blue-100 dark:bg-blue-200 dark:text-blue-800",
|
|
47
|
+
warning:
|
|
48
|
+
"border-t-4 border-yellow-300 text-yellow-700 bg-yellow-100 dark:bg-yellow-200 dark:text-yellow-800",
|
|
49
|
+
error:
|
|
50
|
+
"border-t-4 border-red-300 text-red-700 bg-red-100 dark:bg-red-200 dark:text-red-800",
|
|
51
|
+
success:
|
|
52
|
+
"border-t-4 border-green-300 text-green-700 bg-green-100 dark:bg-green-200 dark:text-green-800",
|
|
53
|
+
},
|
|
54
|
+
"left-accent": {
|
|
55
|
+
info: "border-l-4 border-blue-300 text-blue-700 bg-blue-100 dark:bg-blue-200 dark:text-blue-800",
|
|
56
|
+
warning:
|
|
57
|
+
"border-l-4 border-yellow-300 text-yellow-700 bg-yellow-100 dark:bg-yellow-200 dark:text-yellow-800",
|
|
58
|
+
error:
|
|
59
|
+
"border-l-4 border-red-300 text-red-700 bg-red-100 dark:bg-red-200 dark:text-red-800",
|
|
60
|
+
success:
|
|
61
|
+
"border-l-4 border-green-300 text-green-700 bg-green-100 dark:bg-green-200 dark:text-green-800",
|
|
62
|
+
},
|
|
63
|
+
"right-accent": {
|
|
64
|
+
info: "border-r-4 border-blue-300 text-blue-700 bg-blue-100 dark:bg-blue-200 dark:text-blue-800",
|
|
65
|
+
warning:
|
|
66
|
+
"border-r-4 border-yellow-300 text-yellow-700 bg-yellow-100 dark:bg-yellow-200 dark:text-yellow-800",
|
|
67
|
+
error:
|
|
68
|
+
"border-r-4 border-red-300 text-red-700 bg-red-100 dark:bg-red-200 dark:text-red-800",
|
|
69
|
+
success:
|
|
70
|
+
"border-r-4 border-green-300 text-green-700 bg-green-100 dark:bg-green-200 dark:text-green-800",
|
|
71
|
+
},
|
|
72
|
+
"bottom-accent": {
|
|
73
|
+
info: "border-b-4 border-blue-300 text-blue-700 bg-blue-100 dark:bg-blue-200 dark:text-blue-800",
|
|
74
|
+
warning:
|
|
75
|
+
"border-b-4 border-yellow-300 text-yellow-700 bg-yellow-100 dark:bg-yellow-200 dark:text-yellow-800",
|
|
76
|
+
error:
|
|
77
|
+
"border-b-4 border-red-300 text-red-700 bg-red-100 dark:bg-red-200 dark:text-red-800",
|
|
78
|
+
success:
|
|
79
|
+
"border-b-4 border-green-300 text-green-700 bg-green-100 dark:bg-green-200 dark:text-green-800",
|
|
80
|
+
},
|
|
81
|
+
}
|
|
26
82
|
return (
|
|
27
83
|
<div
|
|
28
84
|
className={clsx(
|
|
29
85
|
"mb-4 flex flex-col rounded-lg p-4 text-sm",
|
|
30
|
-
severities[props.severity]
|
|
86
|
+
// severities[props.severity],
|
|
87
|
+
styleVariant[variant][props.severity]
|
|
31
88
|
)}
|
|
32
89
|
role="alert"
|
|
33
90
|
>
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import clsx from "clsx"
|
|
2
|
+
import React from "react"
|
|
3
|
+
|
|
4
|
+
type PinInputTypes = {
|
|
5
|
+
label: string
|
|
6
|
+
icon?: JSX.Element
|
|
7
|
+
digits?: number
|
|
8
|
+
}
|
|
9
|
+
export const HawaPinInput: React.FunctionComponent<PinInputTypes> = ({
|
|
10
|
+
label,
|
|
11
|
+
icon,
|
|
12
|
+
}) => {
|
|
13
|
+
const validate = (evt) => {
|
|
14
|
+
var theEvent = evt || window.event
|
|
15
|
+
|
|
16
|
+
// Handle paste
|
|
17
|
+
if (theEvent.type === "paste") {
|
|
18
|
+
key = evt.clipboardData.getData("text/plain")
|
|
19
|
+
} else {
|
|
20
|
+
// Handle key press
|
|
21
|
+
var key = theEvent.keyCode || theEvent.which
|
|
22
|
+
key = String.fromCharCode(key)
|
|
23
|
+
}
|
|
24
|
+
var regex = /[0-9]|\./
|
|
25
|
+
if (!regex.test(key)) {
|
|
26
|
+
theEvent.returnValue = false
|
|
27
|
+
if (theEvent.preventDefault) theEvent.preventDefault()
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
return (
|
|
31
|
+
<div className="flex flex-row gap-2">
|
|
32
|
+
<SinglePinInput
|
|
33
|
+
onInput={
|
|
34
|
+
(v) =>
|
|
35
|
+
v.target.value.replace(/[^0-9.]/g, "").replace(/(\..*?)\..*/g, "$1")
|
|
36
|
+
// .replace(/[^0-9.]/g, "")
|
|
37
|
+
// .replace(/(..*?)..*/g, "$1")
|
|
38
|
+
// .replace(/^0[^.]/, "0")
|
|
39
|
+
}
|
|
40
|
+
/>
|
|
41
|
+
<SinglePinInput />
|
|
42
|
+
<SinglePinInput />
|
|
43
|
+
<SinglePinInput />
|
|
44
|
+
</div>
|
|
45
|
+
)
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const SinglePinInput = (props) => (
|
|
49
|
+
<input
|
|
50
|
+
type="text"
|
|
51
|
+
maxLength={1}
|
|
52
|
+
className="h-10 w-10 bg-gray-200 text-center"
|
|
53
|
+
{...props}
|
|
54
|
+
/>
|
|
55
|
+
)
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import React from "react"
|
|
2
|
+
import clsx from "clsx"
|
|
3
|
+
|
|
4
|
+
type StatTypes = {
|
|
5
|
+
label?: string
|
|
6
|
+
number?: string
|
|
7
|
+
helperText?: string
|
|
8
|
+
variant?: "plain" | "contained" | "outlined"
|
|
9
|
+
}
|
|
10
|
+
export const HawaStats: React.FunctionComponent<StatTypes> = (props) => {
|
|
11
|
+
let defaultStyle = "flex flex-col gap-1 rounded-lg p-4 text-sm"
|
|
12
|
+
let statStyles = {
|
|
13
|
+
plain: "",
|
|
14
|
+
contained: "bg-primary-200 w-fit",
|
|
15
|
+
// outlined: "border-2 border-primary-200 w-fit",
|
|
16
|
+
outlined: "ring-2 w-fit",
|
|
17
|
+
}
|
|
18
|
+
return (
|
|
19
|
+
<div className={clsx(defaultStyle, statStyles[props.variant])}>
|
|
20
|
+
<div>{props.label}</div>
|
|
21
|
+
<div className="text-2xl font-bold">{props.number}</div>
|
|
22
|
+
<div className="text-xs">{props.helperText}</div>
|
|
23
|
+
</div>
|
|
24
|
+
)
|
|
25
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from "react"
|
|
2
2
|
import clsx from "clsx"
|
|
3
|
+
|
|
3
4
|
import { FaSearch } from "react-icons/fa"
|
|
4
5
|
type TextFieldTypes = {
|
|
5
6
|
margin?: "none" | "normal" | "large"
|
|
@@ -55,10 +56,9 @@ export const HawaTextField: React.FunctionComponent<TextFieldTypes> = ({
|
|
|
55
56
|
/>
|
|
56
57
|
) : props.type === "search" ? (
|
|
57
58
|
<div className="relative">
|
|
58
|
-
<
|
|
59
|
-
color="gray"
|
|
60
|
-
|
|
61
|
-
/>
|
|
59
|
+
<div className="absolute top-1/2 left-3 -translate-y-1/2">
|
|
60
|
+
<FaSearch color="gray" />
|
|
61
|
+
</div>
|
|
62
62
|
<input
|
|
63
63
|
{...props}
|
|
64
64
|
className="mb-0 block w-full rounded-lg border border-gray-300 bg-gray-50 p-2.5 pl-10 text-gray-900 focus:border-blue-500 focus:ring-blue-500 dark:border-gray-600 dark:bg-gray-700 dark:text-white dark:placeholder-gray-400 dark:focus:border-blue-500 dark:focus:ring-blue-500"
|
package/src/elements/index.ts
CHANGED
|
@@ -24,9 +24,11 @@ export * from "./HawaDrawer"
|
|
|
24
24
|
export * from "./HawaCopyrights"
|
|
25
25
|
export * from "./HawaTimeline"
|
|
26
26
|
export * from "./Breadcrumb"
|
|
27
|
+
export * from "./HawaStats"
|
|
27
28
|
// Inputs
|
|
28
29
|
export * from "./HawaTextField"
|
|
29
30
|
export * from "./HawaCardInput"
|
|
31
|
+
export * from "./HawaPinInput"
|
|
30
32
|
// Cards
|
|
31
33
|
export * from "./HawaItemCard"
|
|
32
34
|
export * from "./HawaPricingCard"
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import clsx from "clsx"
|
|
2
|
+
import React, { useState } from "react"
|
|
3
|
+
import { FaAddressCard } from "react-icons/fa"
|
|
4
|
+
type HawaAppLayoutTypes = {
|
|
5
|
+
logoLink: string
|
|
6
|
+
username: string
|
|
7
|
+
userEmail: string
|
|
8
|
+
drawerItems: any
|
|
9
|
+
}
|
|
10
|
+
export const HawaAppLayout: React.FunctionComponent<HawaAppLayoutTypes> = (
|
|
11
|
+
props: any
|
|
12
|
+
) => {
|
|
13
|
+
const [openSideMenu, setOpenSideMenu] = useState(false)
|
|
14
|
+
|
|
15
|
+
return (
|
|
16
|
+
<div className="fixed top-0 left-0 m-0 w-full p-0">
|
|
17
|
+
{/* navbar */}
|
|
18
|
+
<div className="m-0 flex flex-row justify-between bg-red-300 p-2">
|
|
19
|
+
<div>logo</div>
|
|
20
|
+
<div>page title</div>
|
|
21
|
+
<div className="relative mr-2 h-10 w-10 overflow-hidden rounded-full bg-gray-100 dark:bg-gray-600">
|
|
22
|
+
<AvatarIcon />
|
|
23
|
+
</div>
|
|
24
|
+
</div>
|
|
25
|
+
|
|
26
|
+
{/* side menu */}
|
|
27
|
+
<div
|
|
28
|
+
onMouseEnter={() => setOpenSideMenu(true)}
|
|
29
|
+
onMouseLeave={() => setOpenSideMenu(false)}
|
|
30
|
+
className="fixed top-0 flex h-full w-10 flex-col gap-2 bg-blue-300 transition-all hover:w-60"
|
|
31
|
+
>
|
|
32
|
+
{props.drawerItems.map((dItem) => (
|
|
33
|
+
<div className="flex flex-row items-start justify-start bg-yellow-300 p-2">
|
|
34
|
+
{dItem.icon}
|
|
35
|
+
<div className={clsx(openSideMenu ? "visible" : "invisible")}>
|
|
36
|
+
{dItem.text}
|
|
37
|
+
</div>
|
|
38
|
+
</div>
|
|
39
|
+
))}
|
|
40
|
+
</div>
|
|
41
|
+
{/* page content */}
|
|
42
|
+
{props.children}
|
|
43
|
+
</div>
|
|
44
|
+
)
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const AvatarIcon = () => (
|
|
48
|
+
<svg
|
|
49
|
+
className="absolute -left-1 h-12 w-12 text-gray-400"
|
|
50
|
+
fill="currentColor"
|
|
51
|
+
viewBox="0 0 20 20"
|
|
52
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
53
|
+
>
|
|
54
|
+
<path
|
|
55
|
+
fill-rule="evenodd"
|
|
56
|
+
d="M10 9a3 3 0 100-6 3 3 0 000 6zm-7 9a7 7 0 1114 0H3z"
|
|
57
|
+
clip-rule="evenodd"
|
|
58
|
+
></path>
|
|
59
|
+
</svg>
|
|
60
|
+
)
|
|
@@ -0,0 +1,302 @@
|
|
|
1
|
+
import clsx from "clsx"
|
|
2
|
+
import React, { useState } from "react"
|
|
3
|
+
import HawaDrawerItem from "../elements/HawaDrawerItem"
|
|
4
|
+
|
|
5
|
+
const MenuButton = ({ handleClick }) => {
|
|
6
|
+
return (
|
|
7
|
+
<button
|
|
8
|
+
data-drawer-target="drawer-navigation"
|
|
9
|
+
data-drawer-show="drawer-navigation"
|
|
10
|
+
aria-controls="drawer-navigation"
|
|
11
|
+
type="button"
|
|
12
|
+
onClick={handleClick()}
|
|
13
|
+
className="inline-flex items-center rounded-lg p-2 text-sm text-gray-500 hover:bg-gray-100 focus:outline-none focus:ring-2 focus:ring-gray-200 dark:text-gray-400 dark:hover:bg-gray-700 dark:focus:ring-gray-600"
|
|
14
|
+
>
|
|
15
|
+
{/* <span className="sr-only">Open main menu</span> */}
|
|
16
|
+
<svg
|
|
17
|
+
aria-hidden="true"
|
|
18
|
+
className="h-6 w-6"
|
|
19
|
+
fill="currentColor"
|
|
20
|
+
viewBox="0 0 20 20"
|
|
21
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
22
|
+
>
|
|
23
|
+
<path
|
|
24
|
+
fill-rule="evenodd"
|
|
25
|
+
d="M3 5a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1zM3 10a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1zM3 15a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1z"
|
|
26
|
+
clip-rule="evenodd"
|
|
27
|
+
></path>
|
|
28
|
+
</svg>
|
|
29
|
+
</button>
|
|
30
|
+
)
|
|
31
|
+
}
|
|
32
|
+
const ProfileDropdown = (props: any) => {
|
|
33
|
+
return (
|
|
34
|
+
<div
|
|
35
|
+
id="userDropdown"
|
|
36
|
+
className="z-10 hidden w-44 divide-y divide-gray-100 rounded bg-white shadow dark:divide-gray-600 dark:bg-gray-700"
|
|
37
|
+
data-popper-reference-hidden=""
|
|
38
|
+
data-popper-escaped=""
|
|
39
|
+
data-popper-placement="bottom-start"
|
|
40
|
+
// style="position: absolute; inset: 0px auto auto 0px; margin: 0px; transform: translate3d(0px, 295.5px, 0px);"
|
|
41
|
+
>
|
|
42
|
+
<div className="py-3 px-4 text-sm text-gray-900 dark:text-white">
|
|
43
|
+
<div>{props.username}</div>
|
|
44
|
+
<div className="truncate font-medium">{props.userEmail}</div>
|
|
45
|
+
</div>
|
|
46
|
+
<ul
|
|
47
|
+
className="py-1 text-sm text-gray-700 dark:text-gray-200"
|
|
48
|
+
aria-labelledby="avatarButton"
|
|
49
|
+
>
|
|
50
|
+
{props.profileItems.map((it: any) => {
|
|
51
|
+
return <ProfileItem text={it.text} link={it.slug} />
|
|
52
|
+
})}
|
|
53
|
+
</ul>
|
|
54
|
+
<div className="py-1">
|
|
55
|
+
<a
|
|
56
|
+
href="#"
|
|
57
|
+
className="block py-2 px-4 text-sm text-gray-700 hover:bg-gray-100 dark:text-gray-200 dark:hover:bg-gray-600 dark:hover:text-white"
|
|
58
|
+
>
|
|
59
|
+
Sign out
|
|
60
|
+
</a>
|
|
61
|
+
</div>
|
|
62
|
+
</div>
|
|
63
|
+
)
|
|
64
|
+
}
|
|
65
|
+
const DrawerContent = (props: any) => {
|
|
66
|
+
return (
|
|
67
|
+
<div
|
|
68
|
+
id="drawer-navigation"
|
|
69
|
+
className="fixed z-40 h-screen w-80 overflow-y-auto bg-white p-4 dark:bg-gray-800"
|
|
70
|
+
tabIndex={-1}
|
|
71
|
+
aria-labelledby="drawer-navigation-label"
|
|
72
|
+
>
|
|
73
|
+
<div
|
|
74
|
+
// href={props.logoHref}
|
|
75
|
+
className="flex items-center"
|
|
76
|
+
>
|
|
77
|
+
<img
|
|
78
|
+
src={
|
|
79
|
+
"https://my.qawaim.app/_next/image?url=%2Fqawaim-logo.svg&w=256&q=75"
|
|
80
|
+
}
|
|
81
|
+
// src={props.logoLink}
|
|
82
|
+
className="h-9"
|
|
83
|
+
/>
|
|
84
|
+
</div>
|
|
85
|
+
<CloseButton />
|
|
86
|
+
<div className="overflow-y-auto py-4">
|
|
87
|
+
<ul className="space-y-2">
|
|
88
|
+
{props.drawerItems.map((item: any, i: any) => {
|
|
89
|
+
return (
|
|
90
|
+
<HawaDrawerItem action={item.action} key={i} text={item.text} />
|
|
91
|
+
)
|
|
92
|
+
})}
|
|
93
|
+
</ul>
|
|
94
|
+
</div>
|
|
95
|
+
</div>
|
|
96
|
+
)
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
const ProfileItem = (props: any) => {
|
|
100
|
+
return (
|
|
101
|
+
<li>
|
|
102
|
+
<a
|
|
103
|
+
href={props.link}
|
|
104
|
+
className="block py-2 px-4 hover:bg-gray-100 dark:hover:bg-gray-600 dark:hover:text-white"
|
|
105
|
+
>
|
|
106
|
+
{props.text}
|
|
107
|
+
</a>
|
|
108
|
+
</li>
|
|
109
|
+
)
|
|
110
|
+
}
|
|
111
|
+
const CloseButton = () => {
|
|
112
|
+
return (
|
|
113
|
+
<button
|
|
114
|
+
type="button"
|
|
115
|
+
data-drawer-dismiss="drawer-navigation"
|
|
116
|
+
aria-controls="drawer-navigation"
|
|
117
|
+
className="absolute top-2.5 right-2.5 inline-flex items-center rounded-lg bg-transparent p-1.5 text-sm text-gray-400 hover:bg-gray-200 hover:text-gray-900 dark:hover:bg-gray-600 dark:hover:text-white"
|
|
118
|
+
>
|
|
119
|
+
<svg
|
|
120
|
+
aria-hidden="true"
|
|
121
|
+
className="h-5 w-5"
|
|
122
|
+
fill="currentColor"
|
|
123
|
+
viewBox="0 0 20 20"
|
|
124
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
125
|
+
>
|
|
126
|
+
<path
|
|
127
|
+
fill-rule="evenodd"
|
|
128
|
+
d="M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z"
|
|
129
|
+
clip-rule="evenodd"
|
|
130
|
+
></path>
|
|
131
|
+
</svg>
|
|
132
|
+
</button>
|
|
133
|
+
)
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
type LayoutTypes = {
|
|
137
|
+
logoLink: string
|
|
138
|
+
username: string
|
|
139
|
+
userEmail: string
|
|
140
|
+
drawerItems: any
|
|
141
|
+
}
|
|
142
|
+
export const HawaSiteLayout: React.FunctionComponent<LayoutTypes> = (
|
|
143
|
+
props: any
|
|
144
|
+
) => {
|
|
145
|
+
const [openSideMenu, setOpenSideMenu] = useState(false)
|
|
146
|
+
return (
|
|
147
|
+
<div className="font-plex">
|
|
148
|
+
<nav className="rounded border-gray-200 dark:bg-gray-900">
|
|
149
|
+
<div className="flex w-full flex-row-reverse items-center justify-between p-3">
|
|
150
|
+
<div
|
|
151
|
+
data-dropdown-toggle="userDropdown"
|
|
152
|
+
data-dropdown-placement="bottom-start"
|
|
153
|
+
className="relative mr-2 h-10 w-10 overflow-hidden rounded-full bg-gray-100 dark:bg-gray-600"
|
|
154
|
+
>
|
|
155
|
+
<svg
|
|
156
|
+
className="absolute -left-1 h-12 w-12 text-gray-400"
|
|
157
|
+
fill="currentColor"
|
|
158
|
+
viewBox="0 0 20 20"
|
|
159
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
160
|
+
>
|
|
161
|
+
<path
|
|
162
|
+
fill-rule="evenodd"
|
|
163
|
+
d="M10 9a3 3 0 100-6 3 3 0 000 6zm-7 9a7 7 0 1114 0H3z"
|
|
164
|
+
clip-rule="evenodd"
|
|
165
|
+
></path>
|
|
166
|
+
</svg>
|
|
167
|
+
</div>
|
|
168
|
+
<div>{props.pageTitle ?? "Home"}</div>
|
|
169
|
+
<div className="flex flex-row-reverse">
|
|
170
|
+
<button
|
|
171
|
+
data-drawer-target="drawer-navigation"
|
|
172
|
+
data-drawer-show="drawer-navigation"
|
|
173
|
+
aria-controls="drawer-navigation"
|
|
174
|
+
type="button"
|
|
175
|
+
onClick={() => {
|
|
176
|
+
setOpenSideMenu(true)
|
|
177
|
+
console.log("opening side menu")
|
|
178
|
+
}}
|
|
179
|
+
className="inline-flex items-center rounded-lg p-2 text-sm text-gray-500 hover:bg-gray-100 focus:outline-none focus:ring-2 focus:ring-gray-200 dark:text-gray-400 dark:hover:bg-gray-700 dark:focus:ring-gray-600"
|
|
180
|
+
>
|
|
181
|
+
<svg
|
|
182
|
+
aria-hidden="true"
|
|
183
|
+
className="h-6 w-6"
|
|
184
|
+
fill="currentColor"
|
|
185
|
+
viewBox="0 0 20 20"
|
|
186
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
187
|
+
>
|
|
188
|
+
<path
|
|
189
|
+
fill-rule="evenodd"
|
|
190
|
+
d="M3 5a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1zM3 10a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1zM3 15a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1z"
|
|
191
|
+
clip-rule="evenodd"
|
|
192
|
+
></path>
|
|
193
|
+
</svg>
|
|
194
|
+
</button>{" "}
|
|
195
|
+
</div>
|
|
196
|
+
</div>
|
|
197
|
+
</nav>
|
|
198
|
+
<div
|
|
199
|
+
id="drawer-navigation"
|
|
200
|
+
// className="fixed z-40 h-screen w-80 overflow-y-auto bg-white p-4 dark:bg-gray-800"
|
|
201
|
+
className={clsx(
|
|
202
|
+
"flex w-80 flex-col items-center bg-red-300",
|
|
203
|
+
"fixed top-0 left-0 z-40 h-screen w-80 overflow-y-auto p-4 dark:bg-gray-800",
|
|
204
|
+
openSideMenu ? "visible" : "invisible"
|
|
205
|
+
)}
|
|
206
|
+
tabIndex={-1}
|
|
207
|
+
aria-labelledby="drawer-navigation-label"
|
|
208
|
+
>
|
|
209
|
+
<div>
|
|
210
|
+
<img
|
|
211
|
+
src={
|
|
212
|
+
"https://my.qawaim.app/_next/image?url=%2Fqawaim-logo.svg&w=256&q=75"
|
|
213
|
+
}
|
|
214
|
+
// src={props.logoLink}
|
|
215
|
+
className="h-9"
|
|
216
|
+
/>
|
|
217
|
+
</div>
|
|
218
|
+
<button
|
|
219
|
+
type="button"
|
|
220
|
+
onClick={() => setOpenSideMenu(false)}
|
|
221
|
+
data-drawer-dismiss="drawer-navigation"
|
|
222
|
+
aria-controls="drawer-navigation"
|
|
223
|
+
className="absolute top-2.5 right-2.5 inline-flex items-center rounded-lg bg-transparent p-1.5 text-sm text-gray-400 hover:bg-gray-200 hover:text-gray-900 dark:hover:bg-gray-600 dark:hover:text-white"
|
|
224
|
+
>
|
|
225
|
+
<svg
|
|
226
|
+
aria-hidden="true"
|
|
227
|
+
className="h-5 w-5"
|
|
228
|
+
fill="currentColor"
|
|
229
|
+
viewBox="0 0 20 20"
|
|
230
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
231
|
+
>
|
|
232
|
+
<path
|
|
233
|
+
fill-rule="evenodd"
|
|
234
|
+
d="M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z"
|
|
235
|
+
clip-rule="evenodd"
|
|
236
|
+
></path>
|
|
237
|
+
</svg>
|
|
238
|
+
</button>{" "}
|
|
239
|
+
<div className="overflow-y-auto py-4">
|
|
240
|
+
<ul className="space-y-2">
|
|
241
|
+
{props.drawerItems.map((item: any, i: any) => {
|
|
242
|
+
return (
|
|
243
|
+
<HawaDrawerItem action={item.action} key={i} text={item.text} />
|
|
244
|
+
)
|
|
245
|
+
})}
|
|
246
|
+
</ul>
|
|
247
|
+
</div>
|
|
248
|
+
</div>
|
|
249
|
+
<div className="p-3">{props.children}</div>
|
|
250
|
+
</div>
|
|
251
|
+
)
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
const AppLayoutNav = (props) => (
|
|
255
|
+
<nav className="rounded border-gray-200 dark:bg-gray-900">
|
|
256
|
+
<div className="flex w-full flex-row-reverse items-center justify-between p-3">
|
|
257
|
+
<div
|
|
258
|
+
data-dropdown-toggle="userDropdown"
|
|
259
|
+
data-dropdown-placement="bottom-start"
|
|
260
|
+
className="relative mr-2 h-10 w-10 overflow-hidden rounded-full bg-gray-100 dark:bg-gray-600"
|
|
261
|
+
>
|
|
262
|
+
<svg
|
|
263
|
+
className="absolute -left-1 h-12 w-12 text-gray-400"
|
|
264
|
+
fill="currentColor"
|
|
265
|
+
viewBox="0 0 20 20"
|
|
266
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
267
|
+
>
|
|
268
|
+
<path
|
|
269
|
+
fill-rule="evenodd"
|
|
270
|
+
d="M10 9a3 3 0 100-6 3 3 0 000 6zm-7 9a7 7 0 1114 0H3z"
|
|
271
|
+
clip-rule="evenodd"
|
|
272
|
+
></path>
|
|
273
|
+
</svg>
|
|
274
|
+
</div>
|
|
275
|
+
<div>{props.pageTitle ?? "Home"}</div>
|
|
276
|
+
<div className="flex flex-row-reverse">
|
|
277
|
+
<button
|
|
278
|
+
data-drawer-target="drawer-navigation"
|
|
279
|
+
data-drawer-show="drawer-navigation"
|
|
280
|
+
aria-controls="drawer-navigation"
|
|
281
|
+
type="button"
|
|
282
|
+
onClick={() => props.handleClick()}
|
|
283
|
+
className="inline-flex items-center rounded-lg p-2 text-sm text-gray-500 hover:bg-gray-100 focus:outline-none focus:ring-2 focus:ring-gray-200 dark:text-gray-400 dark:hover:bg-gray-700 dark:focus:ring-gray-600"
|
|
284
|
+
>
|
|
285
|
+
<svg
|
|
286
|
+
aria-hidden="true"
|
|
287
|
+
className="h-6 w-6"
|
|
288
|
+
fill="currentColor"
|
|
289
|
+
viewBox="0 0 20 20"
|
|
290
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
291
|
+
>
|
|
292
|
+
<path
|
|
293
|
+
fill-rule="evenodd"
|
|
294
|
+
d="M3 5a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1zM3 10a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1zM3 15a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1z"
|
|
295
|
+
clip-rule="evenodd"
|
|
296
|
+
></path>
|
|
297
|
+
</svg>
|
|
298
|
+
</button>{" "}
|
|
299
|
+
</div>
|
|
300
|
+
</div>
|
|
301
|
+
</nav>
|
|
302
|
+
)
|
package/src/layout/index.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export * from "./Box"
|
|
2
|
-
|
|
3
|
-
export * from "./
|
|
4
|
-
export * from "./
|
|
5
|
-
export * from "./HawaContainer"
|
|
6
|
-
export * from "./SimpleGrid"
|
|
1
|
+
export * from "./Box"
|
|
2
|
+
export * from "./HawaBottomAppBar"
|
|
3
|
+
export * from "./HawaSiteLayout"
|
|
4
|
+
export * from "./HawaAppLayout"
|
|
5
|
+
export * from "./HawaContainer"
|
|
6
|
+
export * from "./SimpleGrid"
|