lupine.components 1.1.11 → 1.1.14
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/README.md +3 -3
- package/package.json +42 -42
- package/src/components/action-sheet.tsx +419 -419
- package/src/components/button-push-animation.tsx +147 -138
- package/src/components/button.tsx +55 -55
- package/src/components/desktop-footer.tsx +17 -17
- package/src/components/desktop-header.tsx +52 -52
- package/src/components/drag-refresh.tsx +129 -129
- package/src/components/editable-label.tsx +83 -83
- package/src/components/float-window.tsx +233 -233
- package/src/components/grid.tsx +18 -18
- package/src/components/html-load.tsx +41 -41
- package/src/components/html-var.tsx +81 -81
- package/src/components/index.ts +43 -44
- package/src/components/input-with-title.tsx +24 -24
- package/src/components/link-item.tsx +13 -13
- package/src/components/link-list.tsx +62 -62
- package/src/components/menu-bar.tsx +219 -219
- package/src/components/menu-item-props.tsx +13 -13
- package/src/components/menu-sidebar.tsx +325 -318
- package/src/components/message-box.tsx +44 -44
- package/src/components/meta-data.tsx +36 -36
- package/src/components/meta-description.tsx +12 -12
- package/src/components/mobile-components/icon-menu-item-props.ts +6 -6
- package/src/components/mobile-components/index.ts +8 -9
- package/src/components/mobile-components/mobile-footer-menu.tsx +95 -95
- package/src/components/mobile-components/mobile-header-component.tsx +101 -101
- package/src/components/mobile-components/mobile-header-title-icon.tsx +109 -95
- package/src/components/mobile-components/mobile-header-with-back.tsx +127 -104
- package/src/components/mobile-components/mobile-side-menu.tsx +154 -154
- package/src/components/mobile-components/mobile-top-sys-icon.tsx +18 -18
- package/src/components/mobile-components/mobile-top-sys-menu.tsx +62 -62
- package/src/components/modal.tsx +33 -33
- package/src/components/notice-message.tsx +118 -118
- package/src/components/page-title.tsx +6 -6
- package/src/components/paging-link.tsx +175 -175
- package/src/components/panel.tsx +21 -21
- package/src/components/popup-menu.tsx +289 -289
- package/src/components/progress.tsx +91 -91
- package/src/components/radio-label-component.tsx +36 -36
- package/src/components/redirect.tsx +19 -19
- package/src/components/resizable-splitter.tsx +128 -128
- package/src/components/select-angle-component.tsx +127 -127
- package/src/components/select-with-title.tsx +37 -37
- package/src/components/slide-tab-component.tsx +144 -149
- package/src/components/spinner.tsx +106 -100
- package/src/components/stars-component.tsx +66 -66
- package/src/components/svg.tsx +24 -24
- package/src/components/tabs.tsx +279 -279
- package/src/components/text-glow.tsx +37 -37
- package/src/components/text-scale.tsx +42 -42
- package/src/components/text-wave.tsx +55 -55
- package/src/components/theme-selector.tsx +28 -28
- package/src/components/toggle-base.tsx +269 -269
- package/src/components/toggle-switch.tsx +160 -160
- package/src/frames/index.ts +3 -3
- package/src/frames/responsive-frame.tsx +83 -83
- package/src/frames/slider-frame.tsx +111 -111
- package/src/frames/top-frame.tsx +30 -30
- package/src/index.ts +5 -5
- package/src/lib/back-action-helper.ts +54 -54
- package/src/lib/base62.ts +23 -23
- package/src/lib/blob-utils.ts +23 -23
- package/src/lib/calculate-text-width.ts +13 -13
- package/src/lib/date-utils.ts +317 -317
- package/src/lib/deep-merge.ts +37 -37
- package/src/lib/document-ready.ts +34 -34
- package/src/lib/dom-utils.ts +32 -32
- package/src/lib/download-file.ts +118 -118
- package/src/lib/download-link.ts +12 -12
- package/src/lib/download-stream.ts +19 -19
- package/src/lib/drag-util.ts +118 -118
- package/src/lib/dynamical-load.ts +134 -134
- package/src/lib/encode-html.ts +27 -0
- package/src/lib/find-parent-tag.ts +8 -8
- package/src/lib/format-bytes.ts +11 -11
- package/src/lib/index.ts +24 -24
- package/src/lib/lite-dom.ts +225 -225
- package/src/lib/message-hub.ts +103 -104
- package/src/lib/observable.ts +188 -188
- package/src/lib/path-utils.ts +42 -42
- package/src/lib/promise-timeout.ts +1 -1
- package/src/lib/simple-storage.ts +40 -40
- package/src/lib/stop-propagation.ts +7 -7
- package/src/lib/upload-file.ts +101 -101
- package/src/styles/base-themes.ts +17 -17
- package/src/styles/dark-themes.ts +99 -99
- package/src/styles/index.ts +5 -5
- package/src/styles/light-themes.ts +106 -106
- package/src/styles/media-query.ts +93 -93
- package/src/styles/shared-themes.ts +57 -57
- package/tsconfig.json +113 -113
- package/src/lib/escape-html.ts +0 -9
|
@@ -1,219 +1,219 @@
|
|
|
1
|
-
import { getRenderPageProps, RefProps } from 'lupine.web';
|
|
2
|
-
import { MediaQueryMaxWidth } from '../styles';
|
|
3
|
-
import { LinkItem } from './link-item';
|
|
4
|
-
import { NestMenuItemProps } from './menu-item-props';
|
|
5
|
-
|
|
6
|
-
const fetchMenu = async (menuId: string) => {
|
|
7
|
-
const data = await getRenderPageProps().renderPageFunctions.fetchData(`/api/menu/get/${menuId}`);
|
|
8
|
-
return data.json;
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
export type MenuBarProps = {
|
|
12
|
-
menuId?: string;
|
|
13
|
-
items: NestMenuItemProps[];
|
|
14
|
-
className?: string;
|
|
15
|
-
textColor?: string;
|
|
16
|
-
hoverColor?: string;
|
|
17
|
-
hoverBgColor?: string;
|
|
18
|
-
maxWidthMobileMenu?: string;
|
|
19
|
-
maxWidth?: string;
|
|
20
|
-
backgroundColor?: string;
|
|
21
|
-
};
|
|
22
|
-
export const MenuBar = ({
|
|
23
|
-
menuId,
|
|
24
|
-
items,
|
|
25
|
-
className,
|
|
26
|
-
textColor = 'var(--menubar-color)',
|
|
27
|
-
backgroundColor = 'var(--menubar-bg-color)', //'black',
|
|
28
|
-
hoverColor = 'var(--activatable-color-hover)', //'#ffffff',
|
|
29
|
-
hoverBgColor = 'var(--activatable-bg-color-hover)', //'#d12121',
|
|
30
|
-
maxWidth = '100%',
|
|
31
|
-
maxWidthMobileMenu = MediaQueryMaxWidth.TabletMax,
|
|
32
|
-
}: MenuBarProps) => {
|
|
33
|
-
const css: any = {
|
|
34
|
-
width: '100%',
|
|
35
|
-
maxWidth: maxWidth,
|
|
36
|
-
margin: 'auto',
|
|
37
|
-
// height: 'auto',
|
|
38
|
-
backgroundColor,
|
|
39
|
-
position: 'relative',
|
|
40
|
-
'.menu-bar-top': {
|
|
41
|
-
display: 'flex',
|
|
42
|
-
width: '100%',
|
|
43
|
-
justifyContent: 'center',
|
|
44
|
-
},
|
|
45
|
-
'.menu-bar-item': {
|
|
46
|
-
display: 'inline-block',
|
|
47
|
-
color: textColor,
|
|
48
|
-
padding: '14px 16px',
|
|
49
|
-
textDecoration: 'none',
|
|
50
|
-
position: 'relative',
|
|
51
|
-
},
|
|
52
|
-
'.menu-bar-item:hover, .menu-bar-sub-box:hover > .menu-bar-item': {
|
|
53
|
-
// for desktop, make parent menu hover when sub menu is hover
|
|
54
|
-
color: hoverColor,
|
|
55
|
-
backgroundColor: hoverBgColor,
|
|
56
|
-
},
|
|
57
|
-
'.menu-bar-sub-box .menu-bar-sub': {
|
|
58
|
-
display: 'none',
|
|
59
|
-
position: 'absolute',
|
|
60
|
-
backgroundColor: 'var(--menubar-sub-bg-color)', //'#f9f9f9',
|
|
61
|
-
minWidth: '165px',
|
|
62
|
-
boxShadow: '0px 8px 16px 0px rgba(0,0,0,0.2)',
|
|
63
|
-
zIndex: 'var(--layer-menu-sub)',
|
|
64
|
-
flexDirection: 'column',
|
|
65
|
-
},
|
|
66
|
-
'.menu-bar-sub-box > .menu-bar-item': {
|
|
67
|
-
padding: '14px 26px 14px 16px',
|
|
68
|
-
width: '100%',
|
|
69
|
-
},
|
|
70
|
-
'.menu-bar-sub-box > .menu-bar-item::after': {
|
|
71
|
-
content: '""',
|
|
72
|
-
position: 'absolute',
|
|
73
|
-
top: '50%',
|
|
74
|
-
transform: 'translateY(-50%)',
|
|
75
|
-
marginLeft: '6px',
|
|
76
|
-
width: 0,
|
|
77
|
-
height: 0,
|
|
78
|
-
borderLeft: '5px solid transparent',
|
|
79
|
-
borderRight: '5px solid transparent',
|
|
80
|
-
borderTop: '5px solid ' + textColor,
|
|
81
|
-
},
|
|
82
|
-
'.menu-bar-sub-box .menu-bar-sub > .menu-bar-item': {
|
|
83
|
-
color: 'black',
|
|
84
|
-
},
|
|
85
|
-
'.menu-bar-sub-box:hover > .menu-bar-sub': {
|
|
86
|
-
display: 'flex',
|
|
87
|
-
},
|
|
88
|
-
'.menu-bar-sub-box .menu-bar-sub .menu-bar-item:hover': {
|
|
89
|
-
// backgroundColor: '#ddd',
|
|
90
|
-
color: hoverColor,
|
|
91
|
-
backgroundColor: hoverBgColor,
|
|
92
|
-
},
|
|
93
|
-
'.menu-bar-mobile': {
|
|
94
|
-
display: 'none',
|
|
95
|
-
position: 'relative',
|
|
96
|
-
backgroundColor,
|
|
97
|
-
padding: '5px 18px 6px',
|
|
98
|
-
'.menu-bar-toggle': {
|
|
99
|
-
cursor: 'pointer',
|
|
100
|
-
padding: '14px 0 19px 0',
|
|
101
|
-
'span, span::before, span::after': {
|
|
102
|
-
cursor: 'pointer',
|
|
103
|
-
height: '3px',
|
|
104
|
-
width: '25px',
|
|
105
|
-
borderRadius: '1px',
|
|
106
|
-
background: '#ffffff',
|
|
107
|
-
position: 'absolute',
|
|
108
|
-
display: 'block',
|
|
109
|
-
transition: 'all 300ms ease-in-out',
|
|
110
|
-
},
|
|
111
|
-
'span::before, span::after': {
|
|
112
|
-
content: '""',
|
|
113
|
-
},
|
|
114
|
-
'span::before': {
|
|
115
|
-
top: '-10px',
|
|
116
|
-
},
|
|
117
|
-
'span::after': {
|
|
118
|
-
bottom: '-10px',
|
|
119
|
-
},
|
|
120
|
-
},
|
|
121
|
-
'.menu-bar-toggle.active span': {
|
|
122
|
-
backgroundColor: 'transparent',
|
|
123
|
-
},
|
|
124
|
-
'.menu-bar-toggle.active span::before': {
|
|
125
|
-
transform: 'rotate(45deg)',
|
|
126
|
-
top: 0,
|
|
127
|
-
},
|
|
128
|
-
'.menu-bar-toggle.active span::after': {
|
|
129
|
-
transform: 'rotate(-45deg)',
|
|
130
|
-
top: 0,
|
|
131
|
-
},
|
|
132
|
-
},
|
|
133
|
-
['@media only screen and (max-width: ' + maxWidthMobileMenu + ')']: {
|
|
134
|
-
'.menu-bar-mobile': {
|
|
135
|
-
display: 'block',
|
|
136
|
-
},
|
|
137
|
-
'.menu-bar-top': {
|
|
138
|
-
display: 'none',
|
|
139
|
-
},
|
|
140
|
-
'.menu-bar-top.open': {
|
|
141
|
-
display: 'flex',
|
|
142
|
-
flexDirection: 'column',
|
|
143
|
-
},
|
|
144
|
-
'.menu-bar-top.open .menu-bar-sub-box > .menu-bar-sub': {
|
|
145
|
-
display: 'flex',
|
|
146
|
-
position: 'unset',
|
|
147
|
-
'.menu-bar-item': {
|
|
148
|
-
paddingLeft: '32px',
|
|
149
|
-
color: textColor,
|
|
150
|
-
backgroundColor,
|
|
151
|
-
},
|
|
152
|
-
'.menu-bar-item:hover': {
|
|
153
|
-
color: hoverColor,
|
|
154
|
-
backgroundColor: hoverBgColor,
|
|
155
|
-
},
|
|
156
|
-
},
|
|
157
|
-
'.menu-bar-sub-box:hover > .menu-bar-item': {
|
|
158
|
-
// for mobile, no parent menu hover when sub menu is hover
|
|
159
|
-
color: textColor,
|
|
160
|
-
backgroundColor: backgroundColor,
|
|
161
|
-
},
|
|
162
|
-
'.menu-bar-sub-box:hover > .menu-bar-item:hover': {
|
|
163
|
-
color: hoverColor,
|
|
164
|
-
backgroundColor: hoverBgColor,
|
|
165
|
-
},
|
|
166
|
-
},
|
|
167
|
-
};
|
|
168
|
-
|
|
169
|
-
const renderItems = (items: NestMenuItemProps[], className: string) => {
|
|
170
|
-
return (
|
|
171
|
-
<div class={className}>
|
|
172
|
-
{items.map((item) => {
|
|
173
|
-
return item.items ? (
|
|
174
|
-
<div class='menu-bar-sub-box'>
|
|
175
|
-
<div class='menu-bar-item'>{item.text}</div>
|
|
176
|
-
{renderItems(item.items, 'menu-bar-sub')}
|
|
177
|
-
</div>
|
|
178
|
-
) : (
|
|
179
|
-
<LinkItem className='menu-bar-item' url={item.url} alt={item.alt} text={item.text} />
|
|
180
|
-
);
|
|
181
|
-
})}
|
|
182
|
-
</div>
|
|
183
|
-
);
|
|
184
|
-
};
|
|
185
|
-
|
|
186
|
-
const ref: RefProps = {
|
|
187
|
-
onLoad: async () => {
|
|
188
|
-
if (menuId) {
|
|
189
|
-
const menu = await fetchMenu(menuId);
|
|
190
|
-
if (menu.result && menu.result.items.length > 0) {
|
|
191
|
-
const items = menu.result.items.map((i: any) => {
|
|
192
|
-
const l = i.split('\t');
|
|
193
|
-
return { text: l[5], url: l[4] };
|
|
194
|
-
});
|
|
195
|
-
const newDom = renderItems(items, 'menu-bar-top');
|
|
196
|
-
//mountComponents('.menu-bar-top', newDom);
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
},
|
|
200
|
-
};
|
|
201
|
-
const onToggleClick = () => {
|
|
202
|
-
const menu = ref.$('.menu-bar-mobile .menu-bar-toggle');
|
|
203
|
-
menu.classList.toggle('active');
|
|
204
|
-
const topMenu = ref.$('.menu-bar-top');
|
|
205
|
-
topMenu.classList.toggle('open');
|
|
206
|
-
};
|
|
207
|
-
|
|
208
|
-
return (
|
|
209
|
-
<div ref={ref} css={css} class={['menu-bar-box', className].join(' ')}>
|
|
210
|
-
<div class='menu-bar-mobile'>
|
|
211
|
-
<div class='menu-bar-toggle' onClick={onToggleClick}>
|
|
212
|
-
<span></span>
|
|
213
|
-
</div>
|
|
214
|
-
</div>
|
|
215
|
-
|
|
216
|
-
{renderItems(items, 'menu-bar-top')}
|
|
217
|
-
</div>
|
|
218
|
-
);
|
|
219
|
-
};
|
|
1
|
+
import { getRenderPageProps, RefProps } from 'lupine.web';
|
|
2
|
+
import { MediaQueryMaxWidth } from '../styles';
|
|
3
|
+
import { LinkItem } from './link-item';
|
|
4
|
+
import { NestMenuItemProps } from './menu-item-props';
|
|
5
|
+
|
|
6
|
+
const fetchMenu = async (menuId: string) => {
|
|
7
|
+
const data = await getRenderPageProps().renderPageFunctions.fetchData(`/api/menu/get/${menuId}`);
|
|
8
|
+
return data.json;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export type MenuBarProps = {
|
|
12
|
+
menuId?: string;
|
|
13
|
+
items: NestMenuItemProps[];
|
|
14
|
+
className?: string;
|
|
15
|
+
textColor?: string;
|
|
16
|
+
hoverColor?: string;
|
|
17
|
+
hoverBgColor?: string;
|
|
18
|
+
maxWidthMobileMenu?: string;
|
|
19
|
+
maxWidth?: string;
|
|
20
|
+
backgroundColor?: string;
|
|
21
|
+
};
|
|
22
|
+
export const MenuBar = ({
|
|
23
|
+
menuId,
|
|
24
|
+
items,
|
|
25
|
+
className,
|
|
26
|
+
textColor = 'var(--menubar-color)',
|
|
27
|
+
backgroundColor = 'var(--menubar-bg-color)', //'black',
|
|
28
|
+
hoverColor = 'var(--activatable-color-hover)', //'#ffffff',
|
|
29
|
+
hoverBgColor = 'var(--activatable-bg-color-hover)', //'#d12121',
|
|
30
|
+
maxWidth = '100%',
|
|
31
|
+
maxWidthMobileMenu = MediaQueryMaxWidth.TabletMax,
|
|
32
|
+
}: MenuBarProps) => {
|
|
33
|
+
const css: any = {
|
|
34
|
+
width: '100%',
|
|
35
|
+
maxWidth: maxWidth,
|
|
36
|
+
margin: 'auto',
|
|
37
|
+
// height: 'auto',
|
|
38
|
+
backgroundColor,
|
|
39
|
+
position: 'relative',
|
|
40
|
+
'.menu-bar-top': {
|
|
41
|
+
display: 'flex',
|
|
42
|
+
width: '100%',
|
|
43
|
+
justifyContent: 'center',
|
|
44
|
+
},
|
|
45
|
+
'.menu-bar-item': {
|
|
46
|
+
display: 'inline-block',
|
|
47
|
+
color: textColor,
|
|
48
|
+
padding: '14px 16px',
|
|
49
|
+
textDecoration: 'none',
|
|
50
|
+
position: 'relative',
|
|
51
|
+
},
|
|
52
|
+
'.menu-bar-item:hover, .menu-bar-sub-box:hover > .menu-bar-item': {
|
|
53
|
+
// for desktop, make parent menu hover when sub menu is hover
|
|
54
|
+
color: hoverColor,
|
|
55
|
+
backgroundColor: hoverBgColor,
|
|
56
|
+
},
|
|
57
|
+
'.menu-bar-sub-box .menu-bar-sub': {
|
|
58
|
+
display: 'none',
|
|
59
|
+
position: 'absolute',
|
|
60
|
+
backgroundColor: 'var(--menubar-sub-bg-color)', //'#f9f9f9',
|
|
61
|
+
minWidth: '165px',
|
|
62
|
+
boxShadow: '0px 8px 16px 0px rgba(0,0,0,0.2)',
|
|
63
|
+
zIndex: 'var(--layer-menu-sub)',
|
|
64
|
+
flexDirection: 'column',
|
|
65
|
+
},
|
|
66
|
+
'.menu-bar-sub-box > .menu-bar-item': {
|
|
67
|
+
padding: '14px 26px 14px 16px',
|
|
68
|
+
width: '100%',
|
|
69
|
+
},
|
|
70
|
+
'.menu-bar-sub-box > .menu-bar-item::after': {
|
|
71
|
+
content: '""',
|
|
72
|
+
position: 'absolute',
|
|
73
|
+
top: '50%',
|
|
74
|
+
transform: 'translateY(-50%)',
|
|
75
|
+
marginLeft: '6px',
|
|
76
|
+
width: 0,
|
|
77
|
+
height: 0,
|
|
78
|
+
borderLeft: '5px solid transparent',
|
|
79
|
+
borderRight: '5px solid transparent',
|
|
80
|
+
borderTop: '5px solid ' + textColor,
|
|
81
|
+
},
|
|
82
|
+
'.menu-bar-sub-box .menu-bar-sub > .menu-bar-item': {
|
|
83
|
+
color: 'black',
|
|
84
|
+
},
|
|
85
|
+
'.menu-bar-sub-box:hover > .menu-bar-sub': {
|
|
86
|
+
display: 'flex',
|
|
87
|
+
},
|
|
88
|
+
'.menu-bar-sub-box .menu-bar-sub .menu-bar-item:hover': {
|
|
89
|
+
// backgroundColor: '#ddd',
|
|
90
|
+
color: hoverColor,
|
|
91
|
+
backgroundColor: hoverBgColor,
|
|
92
|
+
},
|
|
93
|
+
'.menu-bar-mobile': {
|
|
94
|
+
display: 'none',
|
|
95
|
+
position: 'relative',
|
|
96
|
+
backgroundColor,
|
|
97
|
+
padding: '5px 18px 6px',
|
|
98
|
+
'.menu-bar-toggle': {
|
|
99
|
+
cursor: 'pointer',
|
|
100
|
+
padding: '14px 0 19px 0',
|
|
101
|
+
'span, span::before, span::after': {
|
|
102
|
+
cursor: 'pointer',
|
|
103
|
+
height: '3px',
|
|
104
|
+
width: '25px',
|
|
105
|
+
borderRadius: '1px',
|
|
106
|
+
background: '#ffffff',
|
|
107
|
+
position: 'absolute',
|
|
108
|
+
display: 'block',
|
|
109
|
+
transition: 'all 300ms ease-in-out',
|
|
110
|
+
},
|
|
111
|
+
'span::before, span::after': {
|
|
112
|
+
content: '""',
|
|
113
|
+
},
|
|
114
|
+
'span::before': {
|
|
115
|
+
top: '-10px',
|
|
116
|
+
},
|
|
117
|
+
'span::after': {
|
|
118
|
+
bottom: '-10px',
|
|
119
|
+
},
|
|
120
|
+
},
|
|
121
|
+
'.menu-bar-toggle.active span': {
|
|
122
|
+
backgroundColor: 'transparent',
|
|
123
|
+
},
|
|
124
|
+
'.menu-bar-toggle.active span::before': {
|
|
125
|
+
transform: 'rotate(45deg)',
|
|
126
|
+
top: 0,
|
|
127
|
+
},
|
|
128
|
+
'.menu-bar-toggle.active span::after': {
|
|
129
|
+
transform: 'rotate(-45deg)',
|
|
130
|
+
top: 0,
|
|
131
|
+
},
|
|
132
|
+
},
|
|
133
|
+
['@media only screen and (max-width: ' + maxWidthMobileMenu + ')']: {
|
|
134
|
+
'.menu-bar-mobile': {
|
|
135
|
+
display: 'block',
|
|
136
|
+
},
|
|
137
|
+
'.menu-bar-top': {
|
|
138
|
+
display: 'none',
|
|
139
|
+
},
|
|
140
|
+
'.menu-bar-top.open': {
|
|
141
|
+
display: 'flex',
|
|
142
|
+
flexDirection: 'column',
|
|
143
|
+
},
|
|
144
|
+
'.menu-bar-top.open .menu-bar-sub-box > .menu-bar-sub': {
|
|
145
|
+
display: 'flex',
|
|
146
|
+
position: 'unset',
|
|
147
|
+
'.menu-bar-item': {
|
|
148
|
+
paddingLeft: '32px',
|
|
149
|
+
color: textColor,
|
|
150
|
+
backgroundColor,
|
|
151
|
+
},
|
|
152
|
+
'.menu-bar-item:hover': {
|
|
153
|
+
color: hoverColor,
|
|
154
|
+
backgroundColor: hoverBgColor,
|
|
155
|
+
},
|
|
156
|
+
},
|
|
157
|
+
'.menu-bar-sub-box:hover > .menu-bar-item': {
|
|
158
|
+
// for mobile, no parent menu hover when sub menu is hover
|
|
159
|
+
color: textColor,
|
|
160
|
+
backgroundColor: backgroundColor,
|
|
161
|
+
},
|
|
162
|
+
'.menu-bar-sub-box:hover > .menu-bar-item:hover': {
|
|
163
|
+
color: hoverColor,
|
|
164
|
+
backgroundColor: hoverBgColor,
|
|
165
|
+
},
|
|
166
|
+
},
|
|
167
|
+
};
|
|
168
|
+
|
|
169
|
+
const renderItems = (items: NestMenuItemProps[], className: string) => {
|
|
170
|
+
return (
|
|
171
|
+
<div class={className}>
|
|
172
|
+
{items.map((item) => {
|
|
173
|
+
return item.items ? (
|
|
174
|
+
<div class='menu-bar-sub-box'>
|
|
175
|
+
<div class='menu-bar-item'>{item.text}</div>
|
|
176
|
+
{renderItems(item.items, 'menu-bar-sub')}
|
|
177
|
+
</div>
|
|
178
|
+
) : (
|
|
179
|
+
<LinkItem className='menu-bar-item' url={item.url} alt={item.alt} text={item.text} />
|
|
180
|
+
);
|
|
181
|
+
})}
|
|
182
|
+
</div>
|
|
183
|
+
);
|
|
184
|
+
};
|
|
185
|
+
|
|
186
|
+
const ref: RefProps = {
|
|
187
|
+
onLoad: async () => {
|
|
188
|
+
if (menuId) {
|
|
189
|
+
const menu = await fetchMenu(menuId);
|
|
190
|
+
if (menu.result && menu.result.items.length > 0) {
|
|
191
|
+
const items = menu.result.items.map((i: any) => {
|
|
192
|
+
const l = i.split('\t');
|
|
193
|
+
return { text: l[5], url: l[4] };
|
|
194
|
+
});
|
|
195
|
+
const newDom = renderItems(items, 'menu-bar-top');
|
|
196
|
+
//mountComponents('.menu-bar-top', newDom);
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
},
|
|
200
|
+
};
|
|
201
|
+
const onToggleClick = () => {
|
|
202
|
+
const menu = ref.$('.menu-bar-mobile .menu-bar-toggle');
|
|
203
|
+
menu.classList.toggle('active');
|
|
204
|
+
const topMenu = ref.$('.menu-bar-top');
|
|
205
|
+
topMenu.classList.toggle('open');
|
|
206
|
+
};
|
|
207
|
+
|
|
208
|
+
return (
|
|
209
|
+
<div ref={ref} css={css} class={['menu-bar-box', className].join(' ')}>
|
|
210
|
+
<div class='menu-bar-mobile'>
|
|
211
|
+
<div class='menu-bar-toggle' onClick={onToggleClick}>
|
|
212
|
+
<span></span>
|
|
213
|
+
</div>
|
|
214
|
+
</div>
|
|
215
|
+
|
|
216
|
+
{renderItems(items, 'menu-bar-top')}
|
|
217
|
+
</div>
|
|
218
|
+
);
|
|
219
|
+
};
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
export type MenuItemProps = {
|
|
2
|
-
id: string;
|
|
3
|
-
text: string; // "-" for break line
|
|
4
|
-
url: string;
|
|
5
|
-
js?: () => void;
|
|
6
|
-
alt?: string;
|
|
7
|
-
hide?: boolean;
|
|
8
|
-
devAdmin?: boolean;
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
export type NestMenuItemProps = MenuItemProps & {
|
|
12
|
-
items?: NestMenuItemProps[];
|
|
13
|
-
};
|
|
1
|
+
export type MenuItemProps = {
|
|
2
|
+
id: string;
|
|
3
|
+
text: string; // "-" for break line
|
|
4
|
+
url: string;
|
|
5
|
+
js?: () => void;
|
|
6
|
+
alt?: string;
|
|
7
|
+
hide?: boolean;
|
|
8
|
+
devAdmin?: boolean;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export type NestMenuItemProps = MenuItemProps & {
|
|
12
|
+
items?: NestMenuItemProps[];
|
|
13
|
+
};
|