@sikka/hawa 0.0.183 → 0.0.184
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 +6 -37
- package/es/index.es.js +1 -1
- package/es/layout/HawaAppLayout.d.ts +1 -0
- package/lib/index.js +1 -1
- package/lib/layout/HawaAppLayout.d.ts +1 -0
- package/package.json +1 -1
- package/src/layout/HawaAppLayout.tsx +49 -33
- package/src/styles.css +6 -37
package/package.json
CHANGED
|
@@ -5,7 +5,8 @@ import { HawaMenu } from "../elements"
|
|
|
5
5
|
import { HiMenu } from "react-icons/hi"
|
|
6
6
|
import useBreakpoint from "../hooks/useBreakpoint"
|
|
7
7
|
import { FaChevronRight } from "react-icons/fa"
|
|
8
|
-
|
|
8
|
+
// TODO: add ability to control the width of the drawer
|
|
9
|
+
// TODO: when no navbar, the drawer can't be opened
|
|
9
10
|
type HawaAppLayoutTypes = {
|
|
10
11
|
drawerItems: {
|
|
11
12
|
label: string
|
|
@@ -24,6 +25,7 @@ type HawaAppLayoutTypes = {
|
|
|
24
25
|
topBar?: boolean
|
|
25
26
|
username?: string
|
|
26
27
|
email?: string
|
|
28
|
+
drawerSize?: "sm" | "md" | "large"
|
|
27
29
|
profileMenuItems?: MenuItems[][]
|
|
28
30
|
}
|
|
29
31
|
|
|
@@ -38,6 +40,7 @@ type MenuItems = {
|
|
|
38
40
|
}
|
|
39
41
|
export const HawaAppLayout: React.FunctionComponent<HawaAppLayoutTypes> = ({
|
|
40
42
|
direction = "rtl",
|
|
43
|
+
drawerSize = "lg",
|
|
41
44
|
...props
|
|
42
45
|
}) => {
|
|
43
46
|
const [openSideMenu, setOpenSideMenu] = useState(false)
|
|
@@ -66,31 +69,29 @@ export const HawaAppLayout: React.FunctionComponent<HawaAppLayoutTypes> = ({
|
|
|
66
69
|
|
|
67
70
|
let drawerDefaultStyle =
|
|
68
71
|
"fixed top-0 z-40 flex h-full flex-col justify-between overflow-x-clip bg-layoutPrimary-500 transition-all"
|
|
69
|
-
let ltrDrawerStyle = "left-0"
|
|
70
|
-
let rtlDrawerStyle = "right-0"
|
|
71
72
|
|
|
72
|
-
let
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
73
|
+
let drawerSizeStyle = {
|
|
74
|
+
opened: {
|
|
75
|
+
sm: "100",
|
|
76
|
+
md: "160",
|
|
77
|
+
lg: "250",
|
|
78
|
+
},
|
|
79
|
+
closed: {
|
|
80
|
+
sm: "56",
|
|
81
|
+
md: "56",
|
|
82
|
+
lg: "56",
|
|
83
|
+
},
|
|
84
|
+
}
|
|
85
|
+
let drawerSizeCondition =
|
|
86
|
+
size > 600 ? drawerSizeStyle[keepOpen ? "opened" : "closed"][drawerSize] : 0
|
|
86
87
|
return (
|
|
87
|
-
<div className="
|
|
88
|
+
<div className="absolute left-0 right-0 h-full w-full">
|
|
88
89
|
{/* Top Bar Component */}
|
|
89
90
|
{props.topBar && (
|
|
90
91
|
<div
|
|
91
92
|
className={clsx(
|
|
92
|
-
"fixed top-0 z-30 flex h-14 w-full
|
|
93
|
-
isRTL ? "flex-row-reverse" : ""
|
|
93
|
+
"fixed top-0 z-30 flex h-14 w-full items-center justify-between bg-layoutPrimary-500 p-2",
|
|
94
|
+
isRTL ? "flex-row-reverse" : "flex-row"
|
|
94
95
|
)}
|
|
95
96
|
>
|
|
96
97
|
{/* Nav Side Of Navbar */}
|
|
@@ -115,7 +116,7 @@ export const HawaAppLayout: React.FunctionComponent<HawaAppLayoutTypes> = ({
|
|
|
115
116
|
>
|
|
116
117
|
<div
|
|
117
118
|
onClick={() => setOpenSideMenu(true)}
|
|
118
|
-
className="
|
|
119
|
+
className="mr-2 cursor-pointer rounded p-2 transition-all hover:bg-gray-100"
|
|
119
120
|
>
|
|
120
121
|
<HiMenu size={25} />
|
|
121
122
|
</div>
|
|
@@ -173,17 +174,17 @@ export const HawaAppLayout: React.FunctionComponent<HawaAppLayoutTypes> = ({
|
|
|
173
174
|
ref={ref}
|
|
174
175
|
className={clsx(
|
|
175
176
|
drawerDefaultStyle,
|
|
176
|
-
|
|
177
|
+
drawerSizeStyle[drawerSize],
|
|
178
|
+
isRTL ? "right-0" : "left-0"
|
|
177
179
|
)}
|
|
178
180
|
style={{
|
|
179
|
-
// width:"160px",
|
|
180
181
|
width:
|
|
181
182
|
size > 600
|
|
182
183
|
? openSideMenu
|
|
183
|
-
? "
|
|
184
|
-
: "
|
|
184
|
+
? `${drawerSizeStyle["opened"][drawerSize]}px`
|
|
185
|
+
: `${drawerSizeStyle["closed"][drawerSize]}px`
|
|
185
186
|
: openSideMenu
|
|
186
|
-
? "
|
|
187
|
+
? `${drawerSizeStyle["opened"][drawerSize]}px`
|
|
187
188
|
: "0px",
|
|
188
189
|
}}
|
|
189
190
|
>
|
|
@@ -197,7 +198,7 @@ export const HawaAppLayout: React.FunctionComponent<HawaAppLayoutTypes> = ({
|
|
|
197
198
|
{/* Logo Container */}
|
|
198
199
|
<div
|
|
199
200
|
className={clsx(
|
|
200
|
-
"fixed z-50 mb-2 flex h-14 items-center justify-center bg-
|
|
201
|
+
"fixed z-50 mb-2 flex h-14 items-center justify-center bg-transparent p-2 transition-all",
|
|
201
202
|
openSideMenu ? "w-40" : "w-14"
|
|
202
203
|
)}
|
|
203
204
|
>
|
|
@@ -215,7 +216,6 @@ export const HawaAppLayout: React.FunctionComponent<HawaAppLayoutTypes> = ({
|
|
|
215
216
|
{size > 600 ? (
|
|
216
217
|
<img
|
|
217
218
|
className={clsx(
|
|
218
|
-
// " bg-green-500",
|
|
219
219
|
"fixed top-2.5 h-9 transition-all",
|
|
220
220
|
isRTL ? "right-2.5" : "left-2.5",
|
|
221
221
|
openSideMenu ? "invisible opacity-0" : "visible opacity-100"
|
|
@@ -329,8 +329,8 @@ export const HawaAppLayout: React.FunctionComponent<HawaAppLayoutTypes> = ({
|
|
|
329
329
|
<div
|
|
330
330
|
dir={direction}
|
|
331
331
|
className={clsx(
|
|
332
|
-
"fixed top-4
|
|
333
|
-
isRTL ? "right-
|
|
332
|
+
"fixed top-4 z-50 flex w-fit items-center",
|
|
333
|
+
isRTL ? "right-0 justify-start" : "left-32 justify-start",
|
|
334
334
|
"transition-all duration-700",
|
|
335
335
|
openSideMenu && size > 600 ? " opacity-100" : " opacity-0"
|
|
336
336
|
)}
|
|
@@ -357,10 +357,26 @@ export const HawaAppLayout: React.FunctionComponent<HawaAppLayoutTypes> = ({
|
|
|
357
357
|
</div>
|
|
358
358
|
) : null}
|
|
359
359
|
</div>
|
|
360
|
-
|
|
360
|
+
{/*
|
|
361
|
+
|
|
361
362
|
{/* Children Container */}
|
|
362
|
-
<div
|
|
363
|
-
|
|
363
|
+
<div
|
|
364
|
+
className="fixed overflow-y-auto"
|
|
365
|
+
style={
|
|
366
|
+
isRTL
|
|
367
|
+
? {
|
|
368
|
+
width: `calc(100% - ${drawerSizeCondition}px)`,
|
|
369
|
+
top: props.topBar ? "56px" : "0px",
|
|
370
|
+
}
|
|
371
|
+
: {
|
|
372
|
+
width: `calc(100% - ${drawerSizeCondition}px)`,
|
|
373
|
+
left: `${drawerSizeCondition}px`,
|
|
374
|
+
top: props.topBar ? "56px" : "0px",
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
// className={clsx(isRTL ? rtlChildrenStyle : ltrChildrenStyle)}
|
|
378
|
+
>
|
|
379
|
+
<div className="rounded">{props.children}</div>{" "}
|
|
364
380
|
</div>
|
|
365
381
|
</div>
|
|
366
382
|
)
|
package/src/styles.css
CHANGED
|
@@ -623,21 +623,6 @@ video {
|
|
|
623
623
|
.left-8 {
|
|
624
624
|
left: 2rem;
|
|
625
625
|
}
|
|
626
|
-
.left-14 {
|
|
627
|
-
left: 3.5rem;
|
|
628
|
-
}
|
|
629
|
-
.top-14 {
|
|
630
|
-
top: 3.5rem;
|
|
631
|
-
}
|
|
632
|
-
.left-40 {
|
|
633
|
-
left: 10rem;
|
|
634
|
-
}
|
|
635
|
-
.right-14 {
|
|
636
|
-
right: 3.5rem;
|
|
637
|
-
}
|
|
638
|
-
.right-40 {
|
|
639
|
-
right: 10rem;
|
|
640
|
-
}
|
|
641
626
|
.-left-1 {
|
|
642
627
|
left: -0.25rem;
|
|
643
628
|
}
|
|
@@ -653,15 +638,15 @@ video {
|
|
|
653
638
|
.left-2 {
|
|
654
639
|
left: 0.5rem;
|
|
655
640
|
}
|
|
656
|
-
.right-32 {
|
|
657
|
-
right: 8rem;
|
|
658
|
-
}
|
|
659
641
|
.left-32 {
|
|
660
642
|
left: 8rem;
|
|
661
643
|
}
|
|
662
644
|
.top-auto {
|
|
663
645
|
top: auto;
|
|
664
646
|
}
|
|
647
|
+
.top-14 {
|
|
648
|
+
top: 3.5rem;
|
|
649
|
+
}
|
|
665
650
|
.z-50 {
|
|
666
651
|
z-index: 50;
|
|
667
652
|
}
|
|
@@ -689,9 +674,6 @@ video {
|
|
|
689
674
|
.m-1 {
|
|
690
675
|
margin: 0.25rem;
|
|
691
676
|
}
|
|
692
|
-
.m-4 {
|
|
693
|
-
margin: 1rem;
|
|
694
|
-
}
|
|
695
677
|
.mx-2 {
|
|
696
678
|
margin-left: 0.5rem;
|
|
697
679
|
margin-right: 0.5rem;
|
|
@@ -893,15 +875,15 @@ video {
|
|
|
893
875
|
.h-0\.5 {
|
|
894
876
|
height: 0.125rem;
|
|
895
877
|
}
|
|
896
|
-
.h-\[calc\(100\%-3\.5rem\)\] {
|
|
897
|
-
height: calc(100% - 3.5rem);
|
|
898
|
-
}
|
|
899
878
|
.h-9 {
|
|
900
879
|
height: 2.25rem;
|
|
901
880
|
}
|
|
902
881
|
.h-\[1px\] {
|
|
903
882
|
height: 1px;
|
|
904
883
|
}
|
|
884
|
+
.h-\[calc\(100\%-3\.5rem\)\] {
|
|
885
|
+
height: calc(100% - 3.5rem);
|
|
886
|
+
}
|
|
905
887
|
.h-44 {
|
|
906
888
|
height: 11rem;
|
|
907
889
|
}
|
|
@@ -973,15 +955,6 @@ video {
|
|
|
973
955
|
.w-2\/3 {
|
|
974
956
|
width: 66.666667%;
|
|
975
957
|
}
|
|
976
|
-
.w-\[calc\(100\%-3\.5rem\)\] {
|
|
977
|
-
width: calc(100% - 3.5rem);
|
|
978
|
-
}
|
|
979
|
-
.w-\[calc\(100\%-10rem\)\] {
|
|
980
|
-
width: calc(100% - 10rem);
|
|
981
|
-
}
|
|
982
|
-
.w-\[calc\(100\%-10\.01rem\)\] {
|
|
983
|
-
width: calc(100% - 10.01rem);
|
|
984
|
-
}
|
|
985
958
|
.w-40 {
|
|
986
959
|
width: 10rem;
|
|
987
960
|
}
|
|
@@ -1500,10 +1473,6 @@ video {
|
|
|
1500
1473
|
--tw-bg-opacity: 1;
|
|
1501
1474
|
background-color: rgb(31 41 55 / var(--tw-bg-opacity));
|
|
1502
1475
|
}
|
|
1503
|
-
.bg-green-500 {
|
|
1504
|
-
--tw-bg-opacity: 1;
|
|
1505
|
-
background-color: rgb(34 197 94 / var(--tw-bg-opacity));
|
|
1506
|
-
}
|
|
1507
1476
|
.bg-layoutPrimary-300 {
|
|
1508
1477
|
background-color: var(--layout-primary-300);
|
|
1509
1478
|
}
|