feat: support customize theme (#1500)

* refactor: simplify functions and improve variable naming

* feat: add themeEditor component

* feat: support customize theme

* chore: resolve conflict and add LICENCE

* chore: format code

* refactor: use icon replace background url

* feat: improve organization and application theme editor
This commit is contained in:
Yaodong Yu
2023-02-01 22:06:40 +08:00
committed by GitHub
parent b47baa06e1
commit 95b32d5ebf
28 changed files with 13025 additions and 12126 deletions

View File

@ -16,6 +16,7 @@ import React from "react";
import * as Setting from "./Setting";
import {Dropdown} from "antd";
import "./App.less";
import {GlobalOutlined} from "@ant-design/icons";
function flagIcon(country, alt) {
return (
@ -30,6 +31,10 @@ class SelectLanguageBox extends React.Component {
classes: props,
languages: props.languages ?? ["en", "zh", "es", "fr", "de", "ja", "ko", "ru"],
};
Setting.Countries.forEach((country) => {
new Image().src = `${Setting.StaticBaseUrl}/flag-icons/${country.country}.svg`;
});
}
items = Setting.Countries.map((country) => Setting.getItem(country.label, country.key, flagIcon(country.country, country.alt)));
@ -50,7 +55,9 @@ class SelectLanguageBox extends React.Component {
return (
<Dropdown menu={{items: languageItems, onClick}} >
<div className="language-box" style={{display: languageItems.length === 0 ? "none" : null, ...this.props.style}} />
<div className="select-box" style={{display: languageItems.length === 0 ? "none" : null}} >
<GlobalOutlined style={{fontSize: "24px"}} />
</div>
</Dropdown>
);
}