web/frpc&frps: support dark mode (#3327)

This commit is contained in:
fatedier 2023-02-22 14:15:21 +08:00 committed by GitHub
parent 2f59e967a0
commit 31f40aa913
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
19 changed files with 224 additions and 127 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -4,8 +4,8 @@
<head>
<meta charset="utf-8">
<title>frp client admin UI</title>
<script type="module" crossorigin src="./index-fec891f3.js"></script>
<link rel="stylesheet" href="./index-26827c97.css">
<script type="module" crossorigin src="./index-a2ed7ed4.js"></script>
<link rel="stylesheet" href="./index-aa3c7267.css">
</head>
<body>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,11 +1,11 @@
<!DOCTYPE html>
<html lang="en">
<html lang="en" class="dark">
<head>
<meta charset="utf-8">
<title>frps dashboard</title>
<script type="module" crossorigin src="./index-2a8cf2f5.js"></script>
<link rel="stylesheet" href="./index-4ce77078.css">
<script type="module" crossorigin src="./index-b8250b3f.js"></script>
<link rel="stylesheet" href="./index-7b4711f8.css">
</head>
<body>

View File

@ -16,6 +16,7 @@ declare module '@vue/runtime-core' {
ElMenu: typeof import('element-plus/es')['ElMenu']
ElMenuItem: typeof import('element-plus/es')['ElMenuItem']
ElRow: typeof import('element-plus/es')['ElRow']
ElSwitch: typeof import('element-plus/es')['ElSwitch']
ElTable: typeof import('element-plus/es')['ElTable']
ElTableColumn: typeof import('element-plus/es')['ElTableColumn']
Overview: typeof import('./src/components/Overview.vue')['default']

View File

@ -1,9 +1,24 @@
<template>
<div id="app">
<header class="grid-content header-color">
<el-row>
<a class="brand" href="#">frp client</a>
</el-row>
<div class="header-content">
<div class="brand">
<a href="#">frp client</a>
</div>
<div class="dark-switch">
<el-switch
v-model="darkmodeSwitch"
inline-prompt
active-text="Dark"
inactive-text="Light"
@change="toggleDark"
style="
--el-switch-on-color: #444452;
--el-switch-off-color: #589ef8;
"
/>
</div>
</div>
</header>
<section>
<el-row>
@ -33,6 +48,13 @@
</template>
<script setup lang="ts">
import { ref } from "vue";
import { useDark, useToggle } from "@vueuse/core";
const isDark = useDark();
const darkmodeSwitch = ref(isDark);
const toggleDark = useToggle(isDark);
const handleSelect = (key: string) => {
if (key == "") {
window.open("https://github.com/fatedier/frp");
@ -42,7 +64,6 @@ const handleSelect = (key: string) => {
<style>
body {
background-color: #fafafa;
margin: 0px;
font-family: -apple-system, BlinkMacSystemFont, Helvetica Neue, sans-serif;
}
@ -56,20 +77,40 @@ header {
background: #58b7ff;
}
html.dark .header-color {
background: #395c74;
}
.header-content {
display: flex;
align-items: center;
}
#content {
margin-top: 20px;
padding-right: 40px;
}
.brand {
display: flex;
justify-content: flex-start;
}
.brand a {
color: #fff;
background-color: transparent;
margin-left: 20px;
float: left;
line-height: 25px;
font-size: 25px;
padding: 15px 15px;
height: 30px;
text-decoration: none;
}
.dark-switch {
display: flex;
justify-content: flex-end;
flex-grow: 1;
padding-right: 40px;
}
</style>

View File

@ -0,0 +1,5 @@
html.dark {
--el-bg-color: #343432;
--el-fill-color-blank: #343432;
background-color: #343432;
}

View File

@ -1,9 +1,10 @@
import { createApp } from "vue";
import "element-plus/dist/index.css";
import "element-plus/theme-chalk/dark/css-vars.css";
import App from "./App.vue";
import router from "./router";
// import './assets/custom.css'
import "./assets/dark.css";
const app = createApp(App);

View File

@ -16,6 +16,7 @@ declare module '@vue/runtime-core' {
ElPopover: typeof import('element-plus/es')['ElPopover']
ElRow: typeof import('element-plus/es')['ElRow']
ElSubMenu: typeof import('element-plus/es')['ElSubMenu']
ElSwitch: typeof import('element-plus/es')['ElSwitch']
ElTable: typeof import('element-plus/es')['ElTable']
ElTableColumn: typeof import('element-plus/es')['ElTableColumn']
ElTag: typeof import('element-plus/es')['ElTag']

View File

@ -1,5 +1,5 @@
<!DOCTYPE html>
<html lang="en">
<html lang="en" class="dark">
<head>
<meta charset="utf-8">

View File

@ -1,9 +1,24 @@
<template>
<div id="app">
<header class="grid-content header-color">
<el-row>
<a class="brand" href="#">frp</a>
</el-row>
<div class="header-content">
<div class="brand">
<a href="#">frp</a>
</div>
<div class="dark-switch">
<el-switch
v-model="darkmodeSwitch"
inline-prompt
active-text="Dark"
inactive-text="Light"
@change="toggleDark"
style="
--el-switch-on-color: #444452;
--el-switch-off-color: #589ef8;
"
/>
</div>
</div>
</header>
<section>
<el-row>
@ -43,6 +58,13 @@
</template>
<script setup lang="ts">
import { ref } from 'vue'
import { useDark, useToggle } from '@vueuse/core'
const isDark = useDark()
const darkmodeSwitch = ref(isDark)
const toggleDark = useToggle(isDark)
const handleSelect = (key: string) => {
if (key == '') {
window.open('https://github.com/fatedier/frp')
@ -52,7 +74,6 @@ const handleSelect = (key: string) => {
<style>
body {
background-color: #fafafa;
margin: 0px;
font-family: -apple-system, BlinkMacSystemFont, Helvetica Neue, sans-serif;
}
@ -66,20 +87,40 @@ header {
background: #58b7ff;
}
html.dark .header-color {
background: #395c74;
}
.header-content {
display: flex;
align-items: center;
}
#content {
margin-top: 20px;
padding-right: 40px;
}
.brand {
display: flex;
justify-content: flex-start;
}
.brand a {
color: #fff;
background-color: transparent;
margin-left: 20px;
float: left;
line-height: 25px;
font-size: 25px;
padding: 15px 15px;
height: 30px;
text-decoration: none;
}
.dark-switch {
display: flex;
justify-content: flex-end;
flex-grow: 1;
padding-right: 40px;
}
</style>

View File

@ -0,0 +1,5 @@
html.dark {
--el-bg-color: #343432;
--el-fill-color-blank: #343432;
background-color: #343432;
}

View File

@ -173,10 +173,10 @@ fetchData()
<style>
.source {
border: 1px solid #eaeefb;
border-radius: 4px;
transition: 0.2s;
padding: 24px;
padding-left: 24px;
padding-right: 24px;
}
.server_info {

View File

@ -1,9 +1,11 @@
import { createApp } from 'vue'
import 'element-plus/dist/index.css'
import 'element-plus/theme-chalk/dark/css-vars.css'
import App from './App.vue'
import router from './router'
import './assets/custom.css'
import './assets/dark.css'
const app = createApp(App)