@sikka/hawa 0.0.137 → 0.0.139
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/blocks/AuthForms/SignInForm.d.ts +0 -1
- package/es/blocks/AuthForms/SignUpForm.d.ts +1 -0
- package/es/elements/HawaCheckbox.d.ts +1 -0
- package/es/elements/HawaLogoButton.d.ts +1 -1
- package/es/elements/HawaTextField.d.ts +1 -0
- package/es/index.es.js +1 -1
- package/lib/blocks/AuthForms/SignInForm.d.ts +0 -1
- package/lib/blocks/AuthForms/SignUpForm.d.ts +1 -0
- package/lib/elements/HawaCheckbox.d.ts +1 -0
- package/lib/elements/HawaLogoButton.d.ts +1 -1
- package/lib/elements/HawaTextField.d.ts +1 -0
- package/lib/index.js +1 -1
- package/package.json +1 -1
- package/src/blocks/AuthForms/SignInForm.tsx +16 -16
- package/src/blocks/AuthForms/SignUpForm.tsx +20 -17
- package/src/blocks/Payment/CheckoutForm.tsx +2 -11
- package/src/elements/HawaCheckbox.tsx +9 -3
- package/src/elements/HawaLogoButton.tsx +12 -15
- package/src/elements/HawaSelect.tsx +2 -1
- package/src/elements/HawaStats.tsx +3 -3
- package/src/elements/HawaTable.tsx +9 -4
- package/src/elements/HawaTextField.tsx +8 -1
- package/src/hooks/useBreakpoint.ts +1 -1
- 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.ad68749b.iframe.bundle.js +1 -0
- 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/main.3b2c2bdd.iframe.bundle.js +0 -1
- package/storybook-static/runtime~main.4a2964ac.iframe.bundle.js +0 -1
package/package.json
CHANGED
|
@@ -22,7 +22,6 @@ type SignInFormTypes = {
|
|
|
22
22
|
usernameLabel?: string
|
|
23
23
|
usernamePlaceholder?: string
|
|
24
24
|
usernameRequired?: string
|
|
25
|
-
usernameRequiredText?: string
|
|
26
25
|
phoneRequiredText?: string
|
|
27
26
|
passwordLabel?: string
|
|
28
27
|
passwordPlaceholder?: string
|
|
@@ -77,8 +76,8 @@ export const SignInForm: React.FunctionComponent<SignInFormTypes> = (props) => {
|
|
|
77
76
|
label={props.texts.emailLabel}
|
|
78
77
|
helperText={errors.email?.message}
|
|
79
78
|
placeholder={props.texts.emailPlaceholder}
|
|
80
|
-
{...field}
|
|
81
79
|
value={field.value ?? ""}
|
|
80
|
+
onChange={field.onChange}
|
|
82
81
|
/>
|
|
83
82
|
)}
|
|
84
83
|
rules={{
|
|
@@ -94,19 +93,21 @@ export const SignInForm: React.FunctionComponent<SignInFormTypes> = (props) => {
|
|
|
94
93
|
<Controller
|
|
95
94
|
control={control}
|
|
96
95
|
name="username"
|
|
97
|
-
render={({ field }) =>
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
96
|
+
render={({ field }) => {
|
|
97
|
+
return (
|
|
98
|
+
<HawaTextField
|
|
99
|
+
width="full"
|
|
100
|
+
type="text"
|
|
101
|
+
label={props.texts.usernameLabel}
|
|
102
|
+
helperText={errors.username?.message}
|
|
103
|
+
placeholder={props.texts.usernamePlaceholder}
|
|
104
|
+
onChange={field.onChange}
|
|
105
|
+
value={field.value ?? ""}
|
|
106
|
+
/>
|
|
107
|
+
)
|
|
108
|
+
}}
|
|
108
109
|
rules={{
|
|
109
|
-
required: props.texts.
|
|
110
|
+
required: props.texts.usernameRequired,
|
|
110
111
|
}}
|
|
111
112
|
/>
|
|
112
113
|
) : (
|
|
@@ -124,11 +125,10 @@ export const SignInForm: React.FunctionComponent<SignInFormTypes> = (props) => {
|
|
|
124
125
|
<HawaTextField
|
|
125
126
|
width="full"
|
|
126
127
|
type="password"
|
|
127
|
-
defaultValue={field.value ?? ""}
|
|
128
128
|
label={props.texts.passwordLabel}
|
|
129
129
|
placeholder={props.texts.passwordPlaceholder}
|
|
130
130
|
helperText={errors.password?.message}
|
|
131
|
-
{
|
|
131
|
+
onChange={field.onChange}
|
|
132
132
|
value={field.value ?? ""}
|
|
133
133
|
/>
|
|
134
134
|
)}
|
|
@@ -54,6 +54,7 @@ type SignUpFormTypes = {
|
|
|
54
54
|
handleGoogleSignUp: () => void
|
|
55
55
|
handleGithubSignUp: () => void
|
|
56
56
|
handleTwitterSignUp: () => void
|
|
57
|
+
handleRouteToTOS: () => void
|
|
57
58
|
showError: any
|
|
58
59
|
errorTitle: any
|
|
59
60
|
errorText: any
|
|
@@ -89,7 +90,7 @@ export const SignUpForm: React.FunctionComponent<SignUpFormTypes> = (props) => {
|
|
|
89
90
|
label={props.texts.fullNameLabel}
|
|
90
91
|
placeholder={props.texts.fullNamePlaceholder}
|
|
91
92
|
helperText={errors.fullName?.message}
|
|
92
|
-
{
|
|
93
|
+
onChange={field.onChange}
|
|
93
94
|
value={field.value ?? ""}
|
|
94
95
|
/>
|
|
95
96
|
)}
|
|
@@ -108,7 +109,7 @@ export const SignUpForm: React.FunctionComponent<SignUpFormTypes> = (props) => {
|
|
|
108
109
|
label={props.texts.emailLabel}
|
|
109
110
|
helperText={errors.email?.message}
|
|
110
111
|
placeholder={props.texts.emailPlaceholder}
|
|
111
|
-
{
|
|
112
|
+
onChange={field.onChange}
|
|
112
113
|
value={field.value ?? ""}
|
|
113
114
|
/>
|
|
114
115
|
)}
|
|
@@ -132,7 +133,7 @@ export const SignUpForm: React.FunctionComponent<SignUpFormTypes> = (props) => {
|
|
|
132
133
|
label={props.texts.usernameLabel}
|
|
133
134
|
helperText={errors.username?.message}
|
|
134
135
|
placeholder={props.texts.usernamePlaceholder}
|
|
135
|
-
{
|
|
136
|
+
onChange={field.onChange}
|
|
136
137
|
value={field.value ?? ""}
|
|
137
138
|
/>
|
|
138
139
|
)}
|
|
@@ -148,11 +149,11 @@ export const SignUpForm: React.FunctionComponent<SignUpFormTypes> = (props) => {
|
|
|
148
149
|
<HawaTextField
|
|
149
150
|
width="full"
|
|
150
151
|
type="password"
|
|
151
|
-
defaultValue={field.value ?? ""}
|
|
152
|
+
// defaultValue={field.value ?? ""}
|
|
152
153
|
label={props.texts.passwordLabel}
|
|
153
154
|
placeholder={props.texts.passwordPlaceholder}
|
|
154
155
|
helperText={errors.password?.message}
|
|
155
|
-
{
|
|
156
|
+
onChange={field.onChange}
|
|
156
157
|
value={field.value ?? ""}
|
|
157
158
|
/>
|
|
158
159
|
)}
|
|
@@ -165,11 +166,11 @@ export const SignUpForm: React.FunctionComponent<SignUpFormTypes> = (props) => {
|
|
|
165
166
|
<HawaTextField
|
|
166
167
|
width="full"
|
|
167
168
|
type="password"
|
|
168
|
-
defaultValue={field.value ?? ""}
|
|
169
|
+
// defaultValue={field.value ?? ""}
|
|
169
170
|
label={props.texts.confirmPasswordLabel}
|
|
170
171
|
placeholder={props.texts.confirmPasswordPlaceholder}
|
|
171
172
|
helperText={errors.confirm_password?.message}
|
|
172
|
-
{
|
|
173
|
+
onChange={field.onChange}
|
|
173
174
|
value={field.value ?? ""}
|
|
174
175
|
/>
|
|
175
176
|
)}
|
|
@@ -187,8 +188,8 @@ export const SignUpForm: React.FunctionComponent<SignUpFormTypes> = (props) => {
|
|
|
187
188
|
label={"Ref Code"}
|
|
188
189
|
placeholder={props.texts.passwordPlaceholder}
|
|
189
190
|
helperText={errors.password?.message}
|
|
190
|
-
{...field}
|
|
191
191
|
value={field.value ?? ""}
|
|
192
|
+
onChange={field.onChange}
|
|
192
193
|
/>
|
|
193
194
|
)}
|
|
194
195
|
/>
|
|
@@ -210,11 +211,9 @@ export const SignUpForm: React.FunctionComponent<SignUpFormTypes> = (props) => {
|
|
|
210
211
|
{ value: "ad", label: "Advertisement" },
|
|
211
212
|
{ value: "other", label: "Other" },
|
|
212
213
|
]}
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
}
|
|
216
|
-
{...field}
|
|
217
|
-
onChange={(e: any, o: any) => console.log("chooo", e)}
|
|
214
|
+
onChange={(e: any) => {
|
|
215
|
+
field.onChange(e.value)
|
|
216
|
+
}}
|
|
218
217
|
/>
|
|
219
218
|
)}
|
|
220
219
|
/>
|
|
@@ -227,17 +226,20 @@ export const SignUpForm: React.FunctionComponent<SignUpFormTypes> = (props) => {
|
|
|
227
226
|
name="terms_accepted"
|
|
228
227
|
render={({ field }) => (
|
|
229
228
|
<HawaCheckbox
|
|
229
|
+
id="terms_accepted"
|
|
230
230
|
helperText={errors.terms_accepted?.message}
|
|
231
|
-
onChange={
|
|
231
|
+
onChange={field.onChange}
|
|
232
232
|
label={
|
|
233
233
|
<span>
|
|
234
234
|
{props.texts.iAcceptText}{" "}
|
|
235
|
-
<a
|
|
235
|
+
<a
|
|
236
|
+
onClick={props.handleRouteToTOS}
|
|
237
|
+
className="cursor-pointer text-blue-800"
|
|
238
|
+
>
|
|
236
239
|
{props.texts.termsText}
|
|
237
240
|
</a>
|
|
238
241
|
</span>
|
|
239
242
|
}
|
|
240
|
-
{...field}
|
|
241
243
|
/>
|
|
242
244
|
)}
|
|
243
245
|
rules={{ required: props.texts.termsRequiredText }}
|
|
@@ -251,8 +253,9 @@ export const SignUpForm: React.FunctionComponent<SignUpFormTypes> = (props) => {
|
|
|
251
253
|
name="newsletter_accepted"
|
|
252
254
|
render={({ field }) => (
|
|
253
255
|
<HawaCheckbox
|
|
256
|
+
id="newsletter_accepted"
|
|
254
257
|
label={props.texts.subscribeToNewsletter}
|
|
255
|
-
{
|
|
258
|
+
onChange={field.onChange}
|
|
256
259
|
/>
|
|
257
260
|
)}
|
|
258
261
|
/>
|
|
@@ -238,20 +238,11 @@ export const CheckoutForm: React.FunctionComponent<CheckoutFormTypes> = (
|
|
|
238
238
|
fullWidth
|
|
239
239
|
native
|
|
240
240
|
label={props.texts?.countryLabel + " *"}
|
|
241
|
-
// variant="standard"
|
|
242
241
|
helperText={errors.country?.message}
|
|
243
|
-
// displayEmpty
|
|
244
|
-
// disableUnderline
|
|
245
|
-
// validators={["required"]}
|
|
246
242
|
options={countries}
|
|
247
243
|
getOptionLabel={(countries) => countries.country_label}
|
|
248
|
-
//
|
|
249
|
-
|
|
250
|
-
// { label: "Saudi Arabia", value: "saudi_arabia" },
|
|
251
|
-
// { label: "Saudi Arabia", value: "saudi_arabia" },
|
|
252
|
-
// { label: "Saudi Arabia", value: "saudi_arabia" },
|
|
253
|
-
// ]}
|
|
254
|
-
{...field}
|
|
244
|
+
// {...field}
|
|
245
|
+
onChange={(e) => field.onChange(e.country_label)}
|
|
255
246
|
value={field.value ?? ""}
|
|
256
247
|
>
|
|
257
248
|
<option></option>
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import React from "react"
|
|
2
2
|
|
|
3
3
|
type TCheckBoxTypes = {
|
|
4
4
|
centered?: boolean
|
|
5
5
|
label?: any
|
|
6
6
|
helperText?: any
|
|
7
|
+
id: string
|
|
7
8
|
onChange?: (e: React.ChangeEvent<HTMLInputElement>) => void
|
|
8
9
|
}
|
|
9
10
|
|
|
@@ -17,18 +18,23 @@ export const HawaCheckbox: React.FunctionComponent<TCheckBoxTypes> = (
|
|
|
17
18
|
? "flex h-full items-center justify-center"
|
|
18
19
|
: "flex h-full items-start"
|
|
19
20
|
}
|
|
21
|
+
// onClick={(e: any) => props.onChange(e)}
|
|
20
22
|
>
|
|
21
23
|
<input
|
|
22
24
|
type="checkbox"
|
|
23
25
|
value=""
|
|
24
26
|
onChange={(e) => props.onChange(e)}
|
|
25
27
|
className="mt-0.5 rounded border-gray-300 bg-gray-100 text-blue-600 focus:ring-2 focus:ring-blue-500 dark:border-gray-600 dark:bg-gray-700 dark:ring-offset-gray-800 dark:focus:ring-blue-600"
|
|
26
|
-
{
|
|
28
|
+
id={props.id}
|
|
29
|
+
aria-label={props.label}
|
|
27
30
|
/>
|
|
28
31
|
{(props.label || props.helperText) && (
|
|
29
32
|
<div className=" flex flex-col">
|
|
30
33
|
{props.label && (
|
|
31
|
-
<label
|
|
34
|
+
<label
|
|
35
|
+
htmlFor={props.id}
|
|
36
|
+
className="mx-2 text-sm font-medium text-gray-900 dark:text-gray-300"
|
|
37
|
+
>
|
|
32
38
|
{props.label}
|
|
33
39
|
</label>
|
|
34
40
|
)}
|
|
@@ -2,19 +2,17 @@ import React from "react"
|
|
|
2
2
|
|
|
3
3
|
type LogoButtonTypes = {
|
|
4
4
|
lang?: any
|
|
5
|
-
logo?:
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
// "mada",
|
|
17
|
-
// ]),
|
|
5
|
+
logo?:
|
|
6
|
+
| "google"
|
|
7
|
+
| "github"
|
|
8
|
+
| "twitter"
|
|
9
|
+
| "wallet"
|
|
10
|
+
| "googlepay"
|
|
11
|
+
| "applepay"
|
|
12
|
+
| "stcpay"
|
|
13
|
+
| "visa/master"
|
|
14
|
+
| "paypal"
|
|
15
|
+
| "mada"
|
|
18
16
|
onClick?: any
|
|
19
17
|
buttonText?: any
|
|
20
18
|
}
|
|
@@ -145,14 +143,13 @@ export const HawaLogoButton: React.FunctionComponent<LogoButtonTypes> = (
|
|
|
145
143
|
</svg>
|
|
146
144
|
)
|
|
147
145
|
break
|
|
148
|
-
|
|
149
146
|
default:
|
|
150
147
|
break
|
|
151
148
|
}
|
|
152
149
|
return (
|
|
153
150
|
<button
|
|
154
151
|
style={{ direction: isArabic ? "rtl" : "ltr" }}
|
|
155
|
-
{
|
|
152
|
+
onClick={props.onClick}
|
|
156
153
|
className="my-2 flex h-11 w-full flex-row justify-center rounded-xl bg-white align-middle"
|
|
157
154
|
>
|
|
158
155
|
<div className="flex h-full flex-row items-center justify-end">
|
|
@@ -109,7 +109,8 @@ export const HawaSelect: React.FunctionComponent<SelectTypes> = (props) => {
|
|
|
109
109
|
isMulti={props.isMulti}
|
|
110
110
|
isSearchable={props.isSearchable}
|
|
111
111
|
onChange={(newValue: any, action) =>
|
|
112
|
-
props.onChange(newValue.label, action)
|
|
112
|
+
// props.onChange(newValue.label, action)
|
|
113
|
+
props.onChange(newValue, action)
|
|
113
114
|
}
|
|
114
115
|
components={{
|
|
115
116
|
Control,
|
|
@@ -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
|
}
|
|
@@ -47,13 +47,14 @@ export const HawaTable: React.FunctionComponent<TableTypes> = ({
|
|
|
47
47
|
{props.rows ? (
|
|
48
48
|
props.rows.map((singleRow: any, j: any) => (
|
|
49
49
|
<tr
|
|
50
|
-
className="border-b bg-white dark:border-gray-700 dark:bg-gray-800"
|
|
51
50
|
key={j}
|
|
51
|
+
className="border-b bg-white dark:border-gray-700 dark:bg-gray-800"
|
|
52
52
|
>
|
|
53
53
|
{singleRow.map((r: any, i: any) => {
|
|
54
54
|
if (i === 0) {
|
|
55
55
|
return (
|
|
56
56
|
<th
|
|
57
|
+
key={i}
|
|
57
58
|
scope="row"
|
|
58
59
|
className={clsx(
|
|
59
60
|
sizeStyles[size],
|
|
@@ -64,7 +65,11 @@ export const HawaTable: React.FunctionComponent<TableTypes> = ({
|
|
|
64
65
|
</th>
|
|
65
66
|
)
|
|
66
67
|
} else {
|
|
67
|
-
return
|
|
68
|
+
return (
|
|
69
|
+
<td key={i} className={clsx(sizeStyles[size])}>
|
|
70
|
+
{r}
|
|
71
|
+
</td>
|
|
72
|
+
)
|
|
68
73
|
}
|
|
69
74
|
})}
|
|
70
75
|
{props.actions && size !== "small" ? (
|
|
@@ -74,8 +79,8 @@ export const HawaTable: React.FunctionComponent<TableTypes> = ({
|
|
|
74
79
|
className="flex flex-row gap-1"
|
|
75
80
|
// variant={isArabic ? "borderedRight" : "borderedLeft"}
|
|
76
81
|
>
|
|
77
|
-
{props.actions.map((act: any) => {
|
|
78
|
-
return <TableActionButton action={act} />
|
|
82
|
+
{props.actions.map((act: any, s: any) => {
|
|
83
|
+
return <TableActionButton key={s} action={act} />
|
|
79
84
|
})}
|
|
80
85
|
</td>
|
|
81
86
|
) : null}
|
|
@@ -16,6 +16,7 @@ type TextFieldTypes = {
|
|
|
16
16
|
name?: any
|
|
17
17
|
inputProps?: any
|
|
18
18
|
onChange?: any
|
|
19
|
+
ref?: any
|
|
19
20
|
}
|
|
20
21
|
|
|
21
22
|
export const HawaTextField: React.FunctionComponent<TextFieldTypes> = ({
|
|
@@ -37,6 +38,7 @@ export const HawaTextField: React.FunctionComponent<TextFieldTypes> = ({
|
|
|
37
38
|
let defaultStyle = "flex h-fit max-h-fit flex-col justify-center"
|
|
38
39
|
return (
|
|
39
40
|
<div
|
|
41
|
+
// ref={props.ref}
|
|
40
42
|
className={clsx(defaultStyle, marginStyles[margin], widthStyles[width])}
|
|
41
43
|
>
|
|
42
44
|
{props.label && (
|
|
@@ -67,7 +69,12 @@ export const HawaTextField: React.FunctionComponent<TextFieldTypes> = ({
|
|
|
67
69
|
) : (
|
|
68
70
|
<div>
|
|
69
71
|
<input
|
|
70
|
-
{
|
|
72
|
+
onChange={props.onChange}
|
|
73
|
+
type={props.type}
|
|
74
|
+
aria-label={props.label}
|
|
75
|
+
placeholder={props.placeholder}
|
|
76
|
+
defaultValue={props.defaultValue}
|
|
77
|
+
value={props.value}
|
|
71
78
|
className="mb-0 block w-full rounded-lg border border-gray-300 bg-gray-50 p-2.5 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"
|
|
72
79
|
/>
|
|
73
80
|
</div>
|
|
@@ -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}}]);
|