@arcblock/ux 2.11.50 → 2.12.1
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/lib/CloseButton/index.d.ts +5 -0
- package/lib/CloseButton/index.js +29 -0
- package/lib/Colors/index.d.ts +1 -0
- package/lib/Colors/index.js +2 -1
- package/lib/Colors/themes/did-connect.d.ts +55 -0
- package/lib/Colors/themes/did-connect.js +55 -0
- package/lib/Header/demo/images/boards.svg +3 -0
- package/lib/Header/demo/images/chatbot.svg +3 -0
- package/lib/Header/demo/images/gallery.svg +3 -0
- package/lib/NavMenu/images/OCAP.svg +16 -0
- package/lib/NavMenu/images/abt-network.svg +18 -0
- package/lib/NavMenu/images/ai-kit.svg +46 -0
- package/lib/NavMenu/images/aigne.svg +8 -0
- package/lib/NavMenu/images/aistro.svg +14 -0
- package/lib/NavMenu/images/blocklet-framework.svg +25 -0
- package/lib/NavMenu/images/blocklet-launcher.svg +9 -0
- package/lib/NavMenu/images/blocklet-server.svg +19 -0
- package/lib/NavMenu/images/blocklet-store.svg +11 -0
- package/lib/NavMenu/images/creator-studio.svg +42 -0
- package/lib/NavMenu/images/did-connect.svg +26 -0
- package/lib/NavMenu/images/did-name-service.svg +3 -0
- package/lib/NavMenu/images/did-wallet.svg +33 -0
- package/lib/NavMenu/images/did.svg +3 -0
- package/lib/NavMenu/images/nft-studio.svg +19 -0
- package/lib/NavMenu/images/vc.svg +7 -0
- package/lib/NavMenu/images/web3-kit.svg +56 -0
- package/lib/NavMenu/index.d.ts +1 -0
- package/lib/NavMenu/index.js +2 -1
- package/lib/NavMenu/nav-menu-context.d.ts +17 -0
- package/lib/NavMenu/nav-menu-context.js +19 -0
- package/lib/NavMenu/nav-menu.d.ts +10 -5
- package/lib/NavMenu/nav-menu.js +76 -36
- package/lib/NavMenu/products.d.ts +5 -0
- package/lib/NavMenu/products.js +1639 -0
- package/lib/NavMenu/style.d.ts +8 -3
- package/lib/NavMenu/style.js +215 -175
- package/lib/NavMenu/sub-item-group.d.ts +5 -0
- package/lib/NavMenu/sub-item-group.js +44 -0
- package/lib/RelativeTime/index.js +1 -0
- package/lib/SessionUser/components/quick-login-item.d.ts +19 -0
- package/lib/SessionUser/components/quick-login-item.js +122 -0
- package/lib/SessionUser/components/un-login.d.ts +2 -1
- package/lib/SessionUser/components/un-login.js +173 -30
- package/lib/SessionUser/index.js +1 -0
- package/lib/SessionUser/libs/translation.js +4 -2
- package/lib/Typography/index.js +6 -2
- package/lib/Util/style.d.ts +2 -0
- package/lib/Util/style.js +14 -0
- package/package.json +5 -5
- package/src/CloseButton/index.tsx +30 -0
- package/src/Colors/index.ts +1 -0
- package/src/Colors/themes/did-connect.ts +56 -0
- package/src/NavMenu/images/OCAP.svg +16 -0
- package/src/NavMenu/images/abt-network.svg +18 -0
- package/src/NavMenu/images/ai-kit.svg +46 -0
- package/src/NavMenu/images/aigne.svg +8 -0
- package/src/NavMenu/images/aistro.svg +14 -0
- package/src/NavMenu/images/blocklet-framework.svg +25 -0
- package/src/NavMenu/images/blocklet-launcher.svg +9 -0
- package/src/NavMenu/images/blocklet-server.svg +19 -0
- package/src/NavMenu/images/blocklet-store.svg +11 -0
- package/src/NavMenu/images/creator-studio.svg +42 -0
- package/src/NavMenu/images/did-connect.svg +26 -0
- package/src/NavMenu/images/did-name-service.svg +3 -0
- package/src/NavMenu/images/did-wallet.svg +33 -0
- package/src/NavMenu/images/did.svg +3 -0
- package/src/NavMenu/images/nft-studio.svg +19 -0
- package/src/NavMenu/images/vc.svg +7 -0
- package/src/NavMenu/images/web3-kit.svg +56 -0
- package/src/NavMenu/index.ts +1 -0
- package/src/NavMenu/nav-menu-context.tsx +30 -0
- package/src/NavMenu/nav-menu.tsx +98 -61
- package/src/NavMenu/products.tsx +378 -0
- package/src/NavMenu/style.ts +220 -183
- package/src/NavMenu/sub-item-group.tsx +36 -0
- package/src/RelativeTime/index.tsx +1 -0
- package/src/SessionUser/components/quick-login-item.tsx +131 -0
- package/src/SessionUser/components/un-login.tsx +179 -25
- package/src/SessionUser/index.tsx +1 -1
- package/src/SessionUser/libs/translation.ts +2 -0
- package/src/Typography/index.tsx +2 -2
- package/src/Util/style.ts +17 -0
package/lib/NavMenu/style.d.ts
CHANGED
@@ -1,8 +1,13 @@
|
|
1
|
-
type
|
1
|
+
type NavMenuProps = {
|
2
2
|
$bgColor: string;
|
3
3
|
$textColor: string;
|
4
|
+
};
|
5
|
+
export declare const NavMenuRoot: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme> & NavMenuProps, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLElement>, HTMLElement>, {}>;
|
6
|
+
export declare const NavMenuList: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLUListElement>, HTMLUListElement>, {}>;
|
7
|
+
type NavMenuItemProps = {
|
4
8
|
$activeTextColor: string;
|
5
9
|
};
|
6
|
-
export declare const
|
7
|
-
export declare const
|
10
|
+
export declare const NavMenuItem: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme> & NavMenuItemProps, import("react").DetailedHTMLProps<import("react").LiHTMLAttributes<HTMLLIElement>, HTMLLIElement>, {}>;
|
11
|
+
export declare const NavMenuSub: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme> & NavMenuItemProps & import("react").ClassAttributes<HTMLLIElement> & import("react").LiHTMLAttributes<HTMLLIElement>, {}, {}>;
|
12
|
+
export declare const NavMenuSubList: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLUListElement>, HTMLUListElement>, {}>;
|
8
13
|
export {};
|
package/lib/NavMenu/style.js
CHANGED
@@ -1,185 +1,225 @@
|
|
1
1
|
import { styled } from '../Theme';
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
padding: 0;
|
12
|
-
}
|
13
|
-
.navmenu-item,
|
14
|
-
.navmenu-sub {
|
15
|
-
display: flex;
|
16
|
-
align-items: center;
|
17
|
-
}
|
18
|
-
a {
|
19
|
-
color: inherit;
|
20
|
-
text-decoration: none;
|
21
|
-
}
|
22
|
-
/* active/hover */
|
23
|
-
.navmenu-item,
|
24
|
-
.navmenu-sub {
|
25
|
-
color: ${props => props.$textColor};
|
26
|
-
}
|
27
|
-
.navmenu-item--active,
|
28
|
-
.navmenu-item:hover,
|
29
|
-
.navmenu-sub--opened {
|
30
|
-
color: ${props => props.$activeTextColor};
|
31
|
-
}
|
32
|
-
|
33
|
-
.navmenu-item {
|
34
|
-
position: relative;
|
35
|
-
cursor: pointer;
|
36
|
-
transition: color 0.2s ease-in-out;
|
37
|
-
a {
|
38
|
-
white-space: nowrap;
|
39
|
-
}
|
40
|
-
a::before {
|
41
|
-
position: absolute;
|
42
|
-
top: 0;
|
43
|
-
right: 0;
|
44
|
-
bottom: 0;
|
45
|
-
left: 0;
|
46
|
-
background-color: transparent;
|
47
|
-
content: '';
|
48
|
-
}
|
49
|
-
}
|
50
|
-
|
51
|
-
.navmenu-sub {
|
52
|
-
position: relative;
|
53
|
-
cursor: pointer;
|
54
|
-
}
|
55
|
-
/* icon & expand icon */
|
56
|
-
.navmenu-item-icon,
|
57
|
-
.navmenu-sub-icon,
|
58
|
-
.navmenu-sub-expand-icon {
|
59
|
-
display: flex;
|
60
|
-
line-height: 1;
|
61
|
-
}
|
62
|
-
.navmenu-item-icon,
|
63
|
-
.navmenu-sub-icon {
|
64
|
-
margin-right: 4px;
|
65
|
-
}
|
66
|
-
.navmenu-item-icon > *,
|
67
|
-
.navmenu-sub-icon > * {
|
68
|
-
width: auto;
|
69
|
-
height: 22px;
|
70
|
-
max-height: 22px;
|
71
|
-
font-size: 1.5em;
|
72
|
-
}
|
73
|
-
.navmenu-sub-expand-icon {
|
74
|
-
margin-left: 8px;
|
75
|
-
> * {
|
76
|
-
width: 0.8em;
|
77
|
-
height: 0.8em;
|
78
|
-
transition: transform 0.2s ease-in-out;
|
79
|
-
}
|
80
|
-
}
|
81
|
-
`;
|
82
|
-
export const HorizontalStyle = styled(NavMenuBase)`
|
83
|
-
padding: 8px 16px;
|
84
|
-
min-width: 50px;
|
2
|
+
// .navmenu-root
|
3
|
+
export const NavMenuRoot = styled('nav', {
|
4
|
+
shouldForwardProp: prop => prop !== '$bgColor' && prop !== '$textColor'
|
5
|
+
})(({
|
6
|
+
$bgColor,
|
7
|
+
$textColor
|
8
|
+
}) => ({
|
9
|
+
padding: '8px 16px',
|
10
|
+
minWidth: '50px',
|
85
11
|
// FIXME: @zhanghan 这个只是临时的解决方案,会导致 header align right 不能真正的右对齐,需要修改 header 才能真正解决这个问题
|
86
|
-
|
12
|
+
flexGrow: 100,
|
13
|
+
backgroundColor: $bgColor,
|
14
|
+
color: $textColor,
|
15
|
+
fontSize: '16px'
|
16
|
+
}));
|
87
17
|
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
18
|
+
// .navmenu-list
|
19
|
+
export const NavMenuList = styled('ul')(() => ({
|
20
|
+
listStyle: 'none',
|
21
|
+
margin: 0,
|
22
|
+
padding: 0,
|
23
|
+
display: 'flex',
|
24
|
+
alignItems: 'center',
|
25
|
+
// inline 布局
|
26
|
+
'&.navmenu-list--inline ': {
|
27
|
+
flexDirection: 'column',
|
28
|
+
alignItems: 'stretch'
|
29
|
+
}
|
30
|
+
}));
|
31
|
+
// 菜单项 .navmenu-item
|
32
|
+
export const NavMenuItem = styled('li', {
|
33
|
+
shouldForwardProp: prop => prop !== '$activeTextColor'
|
34
|
+
})(({
|
35
|
+
$activeTextColor
|
36
|
+
}) => ({
|
37
|
+
display: 'flex',
|
38
|
+
alignItems: 'center',
|
39
|
+
position: 'relative',
|
40
|
+
padding: '0 12px',
|
41
|
+
whiteSpace: 'nowrap',
|
42
|
+
cursor: 'pointer',
|
43
|
+
transition: 'color 0.2s ease-in-out',
|
44
|
+
// 间距调整
|
45
|
+
'&:first-of-type': {
|
46
|
+
paddingLeft: 0
|
47
|
+
},
|
48
|
+
'&:last-of-type': {
|
49
|
+
paddingRight: 0
|
50
|
+
},
|
51
|
+
// 内部链接
|
52
|
+
a: {
|
53
|
+
whiteSpace: 'nowrap',
|
54
|
+
color: 'inherit',
|
55
|
+
textDecoration: 'none',
|
56
|
+
// 扩大点击区域
|
57
|
+
'&::before': {
|
58
|
+
position: 'absolute',
|
59
|
+
top: 0,
|
60
|
+
right: 0,
|
61
|
+
bottom: 0,
|
62
|
+
left: 0,
|
63
|
+
backgroundColor: 'transparent',
|
64
|
+
content: '""'
|
116
65
|
}
|
117
|
-
}
|
118
|
-
|
119
|
-
.navmenu-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
66
|
+
},
|
67
|
+
// 图标
|
68
|
+
'.navmenu-item__icon': {
|
69
|
+
display: 'flex',
|
70
|
+
alignItems: 'center',
|
71
|
+
justifyContent: 'center',
|
72
|
+
marginRight: '4px',
|
73
|
+
'& > *': {
|
74
|
+
width: 'auto',
|
75
|
+
height: '22px',
|
76
|
+
maxHeight: '22px',
|
77
|
+
fontSize: '1.5em'
|
125
78
|
}
|
126
|
-
|
127
|
-
|
79
|
+
},
|
80
|
+
// 右侧内容
|
81
|
+
'.navmenu-item__content': {
|
82
|
+
height: '32px',
|
83
|
+
display: 'flex',
|
84
|
+
flexDirection: 'column',
|
85
|
+
justifyContent: 'center',
|
86
|
+
alignItems: 'flex-start',
|
87
|
+
gap: '5px'
|
88
|
+
},
|
89
|
+
'.navmenu-item__label': {
|
90
|
+
display: 'flex',
|
91
|
+
alignItems: 'center',
|
92
|
+
'&-arrow': {
|
93
|
+
marginLeft: '6px',
|
94
|
+
fontSize: '14px',
|
95
|
+
opacity: 0,
|
96
|
+
transition: 'opacity 0.2s ease-in-out'
|
128
97
|
}
|
129
|
-
}
|
130
|
-
|
98
|
+
},
|
99
|
+
'.navmenu-item__desc': {
|
100
|
+
fontSize: '14px'
|
101
|
+
},
|
102
|
+
// 悬停状态下
|
103
|
+
'&:hover': {
|
104
|
+
color: $activeTextColor
|
105
|
+
},
|
106
|
+
// 选中状态下
|
107
|
+
'&.navmenu-item--active': {
|
108
|
+
color: $activeTextColor
|
109
|
+
},
|
110
|
+
// Panel 形态下
|
111
|
+
'&.navmenu-item--panel': {
|
112
|
+
padding: '8px 16px',
|
113
|
+
borderRadius: '8px',
|
114
|
+
'.navmenu-item__icon': {
|
115
|
+
width: '32px',
|
116
|
+
height: '32px',
|
117
|
+
marginRight: '16px',
|
118
|
+
border: '1px solid #eff1f5',
|
119
|
+
borderRadius: '4px',
|
120
|
+
color: '#9497a0'
|
121
|
+
},
|
122
|
+
'.navmenu-item__label': {
|
123
|
+
fontSize: '14px',
|
124
|
+
lineHeight: 1,
|
125
|
+
color: '#26292e'
|
126
|
+
},
|
127
|
+
'.navmenu-item__desc': {
|
128
|
+
fontSize: '12px',
|
129
|
+
lineHeight: 1,
|
130
|
+
color: '#9497a0'
|
131
|
+
},
|
132
|
+
'&:hover': {
|
133
|
+
background: '#f9f9fb',
|
134
|
+
transition: 'background 0.2s ease-in-out',
|
135
|
+
'.navmenu-item__label-arrow': {
|
136
|
+
opacity: 1
|
137
|
+
},
|
138
|
+
'.navmenu-item__desc': {
|
139
|
+
color: '#26292e',
|
140
|
+
transition: 'color 0.2s ease-in-out'
|
141
|
+
}
|
142
|
+
},
|
143
|
+
'&.navmenu-item--active': {
|
144
|
+
background: '#f9f9fb'
|
145
|
+
}
|
146
|
+
},
|
147
|
+
// inline 布局中
|
148
|
+
'&.navmenu-item--inline': {
|
149
|
+
margin: 0,
|
150
|
+
padding: '0 16px',
|
151
|
+
minHeight: '48px',
|
152
|
+
lineHeight: '48px',
|
153
|
+
flexWrap: 'wrap'
|
154
|
+
}
|
155
|
+
}));
|
131
156
|
|
132
|
-
|
133
|
-
export const
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
flex: 1 0 100%;
|
166
|
-
margin: 0 -16px;
|
167
|
-
padding-bottom: 8px;
|
168
|
-
.navmenu-item,
|
169
|
-
.navmenu-sub {
|
170
|
-
line-height: 32px;
|
157
|
+
// 包含子菜单的导航项 .navmenu-item .navmenu-sub
|
158
|
+
export const NavMenuSub = styled(NavMenuItem)(() => ({
|
159
|
+
'.navmenu-item': {
|
160
|
+
marginLeft: 0
|
161
|
+
},
|
162
|
+
'& .navmenu-sub__container': {
|
163
|
+
visibility: 'hidden',
|
164
|
+
opacity: 0,
|
165
|
+
position: 'absolute',
|
166
|
+
top: '100%',
|
167
|
+
left: '50%',
|
168
|
+
zIndex: 1,
|
169
|
+
transform: 'translateX(-50%)',
|
170
|
+
paddingTop: '16px',
|
171
|
+
transition: 'opacity 0.2s ease-in-out, visibility 0.2s ease-in-out'
|
172
|
+
},
|
173
|
+
'&.navmenu-sub--opened > .navmenu-sub__container': {
|
174
|
+
visibility: 'visible',
|
175
|
+
opacity: 1
|
176
|
+
},
|
177
|
+
// 扩展图标
|
178
|
+
'.navmenu-sub__expand-icon': {
|
179
|
+
display: 'flex',
|
180
|
+
alignItems: 'center',
|
181
|
+
justifyContent: 'center',
|
182
|
+
marginLeft: '8px',
|
183
|
+
'& > *': {
|
184
|
+
width: '0.8em',
|
185
|
+
height: '0.8em',
|
186
|
+
transition: 'transform 0.2s ease-in-out'
|
187
|
+
},
|
188
|
+
'.navmenu-item--inline &': {
|
189
|
+
marginLeft: 'auto'
|
171
190
|
}
|
172
|
-
}
|
173
|
-
|
174
|
-
|
175
|
-
.navmenu-
|
176
|
-
|
177
|
-
|
178
|
-
|
191
|
+
},
|
192
|
+
// inline 布局
|
193
|
+
'&.navmenu-item--inline': {
|
194
|
+
'.navmenu-sub__container': {
|
195
|
+
position: 'static',
|
196
|
+
transform: 'none',
|
197
|
+
flex: '1 0 100%',
|
198
|
+
margin: '0 -16px',
|
199
|
+
padding: 0,
|
200
|
+
height: 0,
|
201
|
+
overflow: 'hidden',
|
202
|
+
transition: 'height 0.2s ease-in-out'
|
203
|
+
},
|
204
|
+
'&.navmenu-sub--opened > .navmenu-sub__container': {
|
205
|
+
height: 'auto'
|
206
|
+
},
|
207
|
+
'.navmenu-sub__list': {
|
208
|
+
padding: 0,
|
209
|
+
paddingLeft: '16px',
|
210
|
+
boxShadow: 'none'
|
179
211
|
}
|
180
212
|
}
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
213
|
+
}));
|
214
|
+
|
215
|
+
// 下拉子菜单 .navmenu-sub-list
|
216
|
+
export const NavMenuSubList = styled('ul')(() => ({
|
217
|
+
margin: 0,
|
218
|
+
padding: '16px',
|
219
|
+
borderRadius: '4px',
|
220
|
+
background: '#fff',
|
221
|
+
boxShadow: '0 2px 8px rgba(0, 0, 0, 0.15)',
|
222
|
+
'& .navmenu-item + .navmenu-item': {
|
223
|
+
marginTop: '8px'
|
224
|
+
}
|
225
|
+
}));
|
@@ -0,0 +1,5 @@
|
|
1
|
+
import { BoxProps } from '@mui/material';
|
2
|
+
export interface NavMenuSubItemGroupProps extends BoxProps {
|
3
|
+
label: React.ReactNode;
|
4
|
+
}
|
5
|
+
export default function NavMenuSubItemGroup({ label, children, className, sx, ...rest }: NavMenuSubItemGroupProps): import("react/jsx-runtime").JSX.Element;
|
@@ -0,0 +1,44 @@
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
2
|
+
import { Box } from '@mui/material';
|
3
|
+
import { styled } from '../Theme';
|
4
|
+
const Group = styled(Box)`
|
5
|
+
padding: 16px 24px;
|
6
|
+
border-radius: 8px;
|
7
|
+
background-color: white;
|
8
|
+
cursor: auto;
|
9
|
+
|
10
|
+
.group-label {
|
11
|
+
margin-bottom: 8px;
|
12
|
+
color: #71717b;
|
13
|
+
font-size: 12px;
|
14
|
+
}
|
15
|
+
|
16
|
+
.nav {
|
17
|
+
list-style: none;
|
18
|
+
margin: 0;
|
19
|
+
padding: 0;
|
20
|
+
}
|
21
|
+
`;
|
22
|
+
export default function NavMenuSubItemGroup({
|
23
|
+
label,
|
24
|
+
children,
|
25
|
+
className,
|
26
|
+
sx,
|
27
|
+
...rest
|
28
|
+
}) {
|
29
|
+
return /*#__PURE__*/_jsxs(Group, {
|
30
|
+
className: `nav-menu-sub-item-group ${className}`,
|
31
|
+
sx: {
|
32
|
+
...sx
|
33
|
+
},
|
34
|
+
...rest,
|
35
|
+
children: [/*#__PURE__*/_jsx(Box, {
|
36
|
+
className: "group-label",
|
37
|
+
children: label
|
38
|
+
}), /*#__PURE__*/_jsx(Box, {
|
39
|
+
component: "ul",
|
40
|
+
className: "nav",
|
41
|
+
children: children
|
42
|
+
})]
|
43
|
+
});
|
44
|
+
}
|
@@ -0,0 +1,19 @@
|
|
1
|
+
export default function QuickLoginItem({ userSession, locale, onClick, }: {
|
2
|
+
onClick?: () => void;
|
3
|
+
locale?: string;
|
4
|
+
userSession: {
|
5
|
+
user: {
|
6
|
+
avatar: string;
|
7
|
+
did: string;
|
8
|
+
fullName: string;
|
9
|
+
role: string;
|
10
|
+
roleTitle: string;
|
11
|
+
email: string;
|
12
|
+
};
|
13
|
+
extra: {
|
14
|
+
walletOS: string;
|
15
|
+
provider: string;
|
16
|
+
};
|
17
|
+
updatedAt: string;
|
18
|
+
};
|
19
|
+
}): import("react/jsx-runtime").JSX.Element;
|
@@ -0,0 +1,122 @@
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
2
|
+
import DID from '@arcblock/ux/lib/DID';
|
3
|
+
import RelativeTime from '@arcblock/ux/lib/RelativeTime';
|
4
|
+
import WalletOSIcon from '@arcblock/ux/lib/WalletOSIcon';
|
5
|
+
import { Box, Chip, Typography } from '@mui/material';
|
6
|
+
import { temp as colors } from '@arcblock/ux/lib/Colors';
|
7
|
+
import noop from 'lodash/noop';
|
8
|
+
import Avatar from '../../Avatar';
|
9
|
+
import { getSourceProvider } from '../libs/utils';
|
10
|
+
export default function QuickLoginItem({
|
11
|
+
userSession,
|
12
|
+
locale = 'en',
|
13
|
+
onClick = noop
|
14
|
+
}) {
|
15
|
+
const isRawWalletAccount = getSourceProvider(userSession?.user) === 'wallet';
|
16
|
+
return /*#__PURE__*/_jsxs(Box, {
|
17
|
+
sx: {
|
18
|
+
borderRadius: 2,
|
19
|
+
p: 2,
|
20
|
+
transition: 'background-color 0.5s',
|
21
|
+
'&:hover, &:active': {
|
22
|
+
backgroundColor: colors.backgroundsBgSubtileHover
|
23
|
+
},
|
24
|
+
display: 'flex',
|
25
|
+
justifyContent: 'space-between',
|
26
|
+
alignItems: 'center',
|
27
|
+
cursor: 'pointer',
|
28
|
+
'&:hover': {
|
29
|
+
backgroundColor: colors.surfacePrimarySubtitle
|
30
|
+
},
|
31
|
+
width: '100%',
|
32
|
+
backgroundColor: 'white'
|
33
|
+
},
|
34
|
+
onClick: onClick,
|
35
|
+
children: [/*#__PURE__*/_jsxs(Box, {
|
36
|
+
sx: {
|
37
|
+
display: 'flex',
|
38
|
+
alignItems: 'center',
|
39
|
+
gap: 1.5,
|
40
|
+
flex: 1,
|
41
|
+
overflow: 'hidden'
|
42
|
+
},
|
43
|
+
children: [/*#__PURE__*/_jsx(Avatar, {
|
44
|
+
src: userSession.user.avatar,
|
45
|
+
did: userSession.user.did,
|
46
|
+
size: 44,
|
47
|
+
variant: "circle",
|
48
|
+
shape: "circle"
|
49
|
+
}), /*#__PURE__*/_jsxs(Box, {
|
50
|
+
sx: {
|
51
|
+
flex: 1,
|
52
|
+
overflow: 'hidden'
|
53
|
+
},
|
54
|
+
children: [/*#__PURE__*/_jsxs(Typography, {
|
55
|
+
sx: {
|
56
|
+
fontSize: '16px',
|
57
|
+
fontWeight: 500,
|
58
|
+
display: 'flex',
|
59
|
+
alignItems: 'center',
|
60
|
+
gap: 1,
|
61
|
+
color: colors.textBase
|
62
|
+
},
|
63
|
+
children: [userSession.user.fullName, /*#__PURE__*/_jsx(Chip, {
|
64
|
+
label: userSession.user?.roleTitle || userSession.user?.role,
|
65
|
+
size: "small",
|
66
|
+
variant: "outlined",
|
67
|
+
sx: () => ({
|
68
|
+
height: 'auto',
|
69
|
+
fontWeight: 'bold',
|
70
|
+
fontSize: '12px',
|
71
|
+
borderColor: colors.lineBorderStrong,
|
72
|
+
color: colors.textSubtitle
|
73
|
+
})
|
74
|
+
})]
|
75
|
+
}), isRawWalletAccount ? /*#__PURE__*/_jsxs(Box, {
|
76
|
+
sx: {
|
77
|
+
display: 'flex',
|
78
|
+
alignItems: 'center',
|
79
|
+
gap: 0.5
|
80
|
+
},
|
81
|
+
children: [/*#__PURE__*/_jsx(WalletOSIcon, {
|
82
|
+
provider: userSession?.extra?.provider,
|
83
|
+
walletOS: userSession?.extra?.walletOS,
|
84
|
+
color: colors.textSubtitle
|
85
|
+
}), /*#__PURE__*/_jsx(DID
|
86
|
+
// @ts-ignore
|
87
|
+
, {
|
88
|
+
locale: locale,
|
89
|
+
did: userSession.user.did,
|
90
|
+
size: 12,
|
91
|
+
sx: {
|
92
|
+
lineHeight: 1,
|
93
|
+
fontSize: '12px',
|
94
|
+
mt: 0.5,
|
95
|
+
'& span.arc-avatar-did-motif': {
|
96
|
+
display: 'none !important'
|
97
|
+
}
|
98
|
+
},
|
99
|
+
compact: true
|
100
|
+
})]
|
101
|
+
}) : /*#__PURE__*/_jsx(Typography, {
|
102
|
+
sx: {
|
103
|
+
fontSize: '12px',
|
104
|
+
color: colors.textSubtitle
|
105
|
+
},
|
106
|
+
children: userSession.user.email
|
107
|
+
})]
|
108
|
+
})]
|
109
|
+
}), userSession.updatedAt && /*#__PURE__*/_jsx(Box, {
|
110
|
+
component: "span",
|
111
|
+
sx: {
|
112
|
+
color: colors.textMuted,
|
113
|
+
fontSize: '12px',
|
114
|
+
flexShrink: 0
|
115
|
+
},
|
116
|
+
children: /*#__PURE__*/_jsx(RelativeTime, {
|
117
|
+
value: userSession.updatedAt,
|
118
|
+
locale: locale
|
119
|
+
})
|
120
|
+
})]
|
121
|
+
});
|
122
|
+
}
|
@@ -4,5 +4,6 @@ export interface UnLoginProps {
|
|
4
4
|
onLogin?: () => void;
|
5
5
|
size?: number;
|
6
6
|
dark?: false | true;
|
7
|
+
locale?: string;
|
7
8
|
}
|
8
|
-
export default function UnLogin({ session, onLogin, size, dark }: UnLoginProps): import("react/jsx-runtime").JSX.Element;
|
9
|
+
export default function UnLogin({ session, onLogin, size, dark, locale }: UnLoginProps): import("react/jsx-runtime").JSX.Element;
|