Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/MHSanaei/3x-ui.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHo3ein <ho3ein.sanaei@gmail.com>2023-05-08 19:10:02 +0300
committerGitHub <noreply@github.com>2023-05-08 19:10:02 +0300
commit30a5f66f26164e1bcbdf9a0780a40bc56230e73c (patch)
tree749ce90b0895352639d2c45fa176a362b3105b32 /web/html/xui/component
parent7bb3e517b2e279a52fb5627e011ea03fd91f648e (diff)
parentbb6e6861ca683894139c5307bd2d41f2e264fe00 (diff)
Merge pull request #381 from hamid-gh98/main
[FIX] bug logout path + [UPDATE] login UI and more ...
Diffstat (limited to 'web/html/xui/component')
-rw-r--r--web/html/xui/component/password.html35
-rw-r--r--web/html/xui/component/themeSwitch.html58
2 files changed, 93 insertions, 0 deletions
diff --git a/web/html/xui/component/password.html b/web/html/xui/component/password.html
new file mode 100644
index 00000000..ebea3be6
--- /dev/null
+++ b/web/html/xui/component/password.html
@@ -0,0 +1,35 @@
+{{define "component/passwordInput"}}
+<template>
+ <a-input :value="value" :type="showPassword ? 'text' : 'password'"
+ :placeholder="placeholder"
+ @input="$emit('input', $event.target.value)">
+ <template v-if="icon" #prefix>
+ <a-icon :type="icon" :style="'font-size: 16px;' + themeSwitcher.textStyle" />
+ </template>
+ <template #addonAfter>
+ <a-icon :type="showPassword ? 'eye-invisible' : 'eye'"
+ @click="toggleShowPassword"
+ :style="'font-size: 16px;' + themeSwitcher.textStyle" />
+ </template>
+ </a-input>
+</template>
+{{end}}
+
+{{define "component/password"}}
+<script>
+ Vue.component('password-input', {
+ props: ["title", "value", "placeholder", "icon"],
+ template: `{{template "component/passwordInput"}}`,
+ data() {
+ return {
+ showPassword: false,
+ };
+ },
+ methods: {
+ toggleShowPassword() {
+ this.showPassword = !this.showPassword;
+ },
+ },
+ });
+</script>
+{{end}} \ No newline at end of file
diff --git a/web/html/xui/component/themeSwitch.html b/web/html/xui/component/themeSwitch.html
new file mode 100644
index 00000000..35013a9e
--- /dev/null
+++ b/web/html/xui/component/themeSwitch.html
@@ -0,0 +1,58 @@
+{{define "component/themeSwitchTemplate"}}
+<template>
+ <a-switch :default-checked="themeSwitcher.isDarkTheme"
+ checked-children="☀"
+ un-checked-children="🌙"
+ @change="themeSwitcher.toggleTheme()">
+ </a-switch>
+</template>
+{{end}}
+
+{{define "component/themeSwitcher"}}
+<script>
+ const colors = {
+ dark: {
+ bg: "#242c3a",
+ text: "hsla(0,0%,100%,.65)"
+ },
+ light: {
+ bg: '#f0f2f5',
+ text: "rgba(0, 0, 0, 0.7)",
+ }
+ }
+
+ function createThemeSwitcher() {
+ const isDarkTheme = localStorage.getItem('dark-mode') === 'true';
+ const theme = isDarkTheme ? 'dark' : 'light';
+ return {
+ isDarkTheme,
+ bgStyle: `background: ${colors[theme].bg};`,
+ textStyle: `color: ${colors[theme].text};`,
+ darkClass: isDarkTheme ? 'ant-card-dark' : '',
+ darkCardClass: isDarkTheme ? 'ant-card-dark' : '',
+ darkDrawerClass: isDarkTheme ? 'ant-drawer-dark' : '',
+ get currentTheme() {
+ return this.isDarkTheme ? 'dark' : 'light';
+ },
+ toggleTheme() {
+ this.isDarkTheme = !this.isDarkTheme;
+ this.theme = this.isDarkTheme ? 'dark' : 'light';
+ localStorage.setItem('dark-mode', this.isDarkTheme);
+ this.bgStyle = `background: ${colors[this.theme].bg};`;
+ this.textStyle = `color: ${colors[this.theme].text};`;
+ this.darkClass = this.isDarkTheme ? 'ant-card-dark' : '';
+ this.darkCardClass = this.isDarkTheme ? 'ant-card-dark' : '';
+ this.darkDrawerClass = this.isDarkTheme ? 'ant-drawer-dark' : '';
+ },
+ };
+ }
+
+ const themeSwitcher = createThemeSwitcher();
+
+ Vue.component('theme-switch', {
+ props: [],
+ template: `{{template "component/themeSwitchTemplate"}}`,
+ data: () => ({ themeSwitcher }),
+ });
+</script>
+{{end}} \ No newline at end of file