forked from liara-cloud/docs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSmMenu.js
More file actions
266 lines (257 loc) · 8.13 KB
/
Copy pathSmMenu.js
File metadata and controls
266 lines (257 loc) · 8.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
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
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
import React, { Fragment, useContext, useState } from "react";
import Link from "next/link";
import { ThemeContext } from "./root/theme.context";
import PlatformIcon from "./PlatformIcon";
const SmMenu = ({ showSidebar }) => {
const { theme } = useContext(ThemeContext);
const [showChild, setShowChild] = useState({ isOpen: false, index: "-1" });
const handleShowChild = (index, hasChildren) => {
if (!hasChildren) return;
if (showChild.isOpen) return setShowChild({ isOpen: false, index: "-1" });
setShowChild({ isOpen: true, index });
};
const links = [
{ title: "قیمتها", href: "https://liara.ir/pricing/" },
{ title: "وبلاگ", href: "https://liara.ir/blog/" },
{ title: "ویدیوها", href: "/tv" },
{ title: "مستندات", href: "https://docs.liara.ir" },
{
title: "پلتفرم",
href: "#",
hasChildren: true,
children: [
{
title: "PHP",
href: "https://liara.ir/landing/هاست-پی-اچ-پی-php/",
alt: "هاست ابری پیاچچی",
icon: "php",
},
{
title: "VueJS",
href: "https://liara.ir/landing/هاست-ویو-جی-اس-vue/",
alt: "هاست ابری ویو",
icon: "vue",
},
{
title: "Flask",
href: "https://liara.ir/landing/هاست-فلسک-flask/",
alt: "هاست ابری فلسک",
icon: "flask",
},
{
title: ".Net",
href: "https://liara.ir/landing/هاست-دات-نت-dotnet/",
alt: "هاست ابری داتنت",
icon: "dotnet",
},
{
title: "ReactJS",
href: "https://liara.ir/landing/هاست-ری-اکت-react/",
alt: "هاست ابری ریاکت",
icon: "react",
},
{
title: "Angular",
href: "https://liara.ir/landing/هاست-انگولار-angular/",
alt: "هاست ابری انگولار",
icon: "angularjs",
},
{
title: "NodeJS",
href: "https://liara.ir/landing/هاست-نود-جی-اس-node/",
alt: "هاست ابری نودجیاس",
icon: "nodejs",
},
{
title: "Laravel",
href: "https://liara.ir/landing/هاست-لاراول-laravel/",
alt: "هاست ابری لاراول",
icon: "laravel",
},
{
title: "Python",
href: "https://liara.ir/landing/هاست-پایتون-python/",
alt: "هاست ابری پایتون",
icon: "python",
},
{
title: "Django",
href: "https://liara.ir/landing/هاست-جنگو-django/",
alt: "هاست ابری جنگو",
icon: "django",
},
{
title: "NextJS",
href: "https://liara.ir/landing/هاست-نکست-جی-اس-next",
alt: "هاست ابری نکست",
icon: "next",
},
{
title: "NuxtJS",
href: "https://liara.ir/landing/هاست-ناکست-جی-اس-nuxt",
alt: "هاست ابری ناکست",
icon: "nuxt",
},
{
title: "Golang",
href: "https://liara.ir/landing/هاست-گولنگ-golang",
alt: "هاست ابری گولنگ",
icon: "go",
},
{
title: "Docker",
href: "https://liara.ir/landing/هاست-داکر-docker",
alt: "هاست ابری داکر",
icon: "docker",
},
],
},
{
title: "دیتابیس",
href: "#",
hasChildren: true,
children: [
{
title: "MySQL",
href: "https://liara.ir/landing/هاست-ابری-mysql",
alt: "دیتابیس مایاسکیوال",
icon: "mysql",
},
{
title: "MariaDB",
href: "https://liara.ir/landing/هاست-ابری-mariadb",
alt: "دیتابیس ماریا",
icon: "mariadb",
},
{
title: "PostgreSQL",
href: "https://liara.ir/landing/هاست-ابری-postgre-sql",
alt: "دیتابیس پستگرس",
icon: "postgres",
},
{
title: "MSSQL",
href: "https://liara.ir/landing/هاست-ابری-sql-server",
alt: "دیتابیس اس کیو ال سرور",
icon: "mssql",
},
{
title: "MongoDB",
href: "https://liara.ir/landing/هاست-ابری-mongo",
alt: "دیتابیس مونگو",
icon: "mongodb",
},
{
title: "Redis",
href: "https://liara.ir/landing/هاست-ابری-redis",
alt: "دیتابیس ردیس",
icon: "redis",
},
{
title: "RabbitMQ",
href: "https://liara.ir/landing/هاست-ابری-rabbit",
alt: "دیتابیس ربیت ام کیو",
icon: "rabbitmq",
},
{
title: "Elastic",
href: "https://liara.ir/landing/هاست-ابری-elastic-search",
alt: "دیتابیس الاستیک",
icon: "elastic",
},
],
},
{
title: "سامانه مدیریت دامنه",
badge: "DNS",
href: "https://liara.ir/products/dns/",
},
{
title: " ایمیل",
badge: "Email",
href: "https://liara.ir/products/email/",
},
{
title: "وردپرس پلاس",
badge: "WP Plus",
href: "https://liara.ir/products/wp-plus/",
},
{
title: "ذخیرهسازی ابری",
badge: "Object Storage",
href: "https://liara.ir/products/object-storage/",
},
];
return (
<Fragment>
<div
className="sm-menu-container"
style={{ transform: `translateX(${showSidebar ? 0 : `77vw`})` }}
>
<a href="https://liara.ir/" className="sm-logo">
<img src={`/static/liara-logo-${theme}.svg`} alt="liara logo" />
</a>
<div className="to-console">
<a href="https://console.liara.ir/register">
<button
className="grad"
style={{
fontSize: "14px !important",
fontWeight: "600 !important",
padding: "8px 20px",
}}
>
ایجاد حساب کاربری
</button>
</a>
<a href="https://console.liara.ir/login" className="gradient-text">
ورود
</a>
</div>
<ul className="page-links">
{links.map((item, id) => (
<li
key={id}
className="main-li"
onClick={() => handleShowChild(id, item.hasChildren)}
>
<a href={item.href}>
{item.title}{" "}
{item.hasChildren && (
<span style={{ color: "#ccc", margin: "5px 7px 0px" }}>
{" "}
▾{" "}
</span>
)}
{item.hasChildren && (
<div className="children-container">
{/* <ul style={showChild.index === id ? {height : "max-content"} : {height : 0}}> */}
<ul
style={
showChild.index === id
? { opacity: 1, height: "max-content" }
: { opacity: 0, height: "0" }
}
>
{item.children.map((child, i) => (
<li key={i}>
<div
onClick={() => window.open(child.href, "_blank")}
>
<PlatformIcon platform={child.icon} />
{child.title}
</div>
</li>
))}
</ul>
</div>
)}
</a>
</li>
))}
</ul>
</div>
</Fragment>
);
};
export default SmMenu;