fix(root_frame): clean up styles

This commit is contained in:
hexxa 2022-03-13 17:26:20 +08:00 committed by Hexxa
parent 73f3cb2da6
commit 1b4dec878b
9 changed files with 102 additions and 88 deletions

View file

@ -423,7 +423,7 @@
} }
.grey3-bg { .grey3-bg {
color: #697384; background-color: #697384;
} }
.black-bg { .black-bg {

View file

@ -44,30 +44,18 @@ img {
user-select: none; /* Non-prefixed version, currently supported by Chrome and Opera */ user-select: none; /* Non-prefixed version, currently supported by Chrome and Opera */
} }
a { a {
color: #16a085;
opacity: 100%; opacity: 100%;
text-decoration: none; text-decoration: none;
transition: color 1s 1 linear; transition: color 300ms;
}
a:hover {
color: #2ecc71;
}
a:active {
} }
a::selection { a::selection {
background: transparent; background: transparent;
} }
button { span,
background-color: transparent; div,
border: none; svg {
outline: none; transition: color 300ms, background-color 300ms;
}
button:active {
/* animation: fade 0.1s 1 linear; */
}
button:hover {
/* animation: fade 0.1s 1 linear; */
} }
img { img {
@ -88,31 +76,30 @@ input {
padding: 0.8rem 1rem; padding: 0.8rem 1rem;
width: 10rem; width: 10rem;
background-color: rgba(0, 0, 0, 0.15);
border-radius: 0.5rem; border-radius: 0.5rem;
transition: opacity 300ms, box-shadow 300ms;
} }
input:focus { input:focus {
opacity: 0.8; opacity: 0.8;
box-shadow: 0 0.1rem 1rem rgba(0, 0, 0, 0.1);
}
::placeholder {
color: #95a5a6;
} }
button { button {
cursor: pointer; cursor: pointer;
border: none; border: none;
border-radius: 0.5rem; border-radius: 0.5rem;
outline: none;
padding: 0.8rem 1rem; padding: 0.8rem 1rem;
background-color: rgba(0, 0, 0, 0.3);
font-weight: bold; font-weight: bold;
border-radius: 0.5rem; border-radius: 0.5rem;
}
button:hover { transition: opacity 300ms;
opacity: 0.9; }
button:hover {
opacity: 0.8;
}
button:active {
opacity: 1;
} }

View file

@ -1,3 +1,52 @@
.dark-font {
color: #34495e;
}
.light-font {
color: #95a5a6;
}
.normal-font {
color: #697384;
}
.highlight-font {
color: #16a085;
}
.error-font {
color: #f1c40f;
}
.light-bg {
background-color: white;
}
.normal-bg {
background-color: #ecf0f6;
}
.highlight-bg {
color: #16a085;
}
.dark-bg {
background-color: #2c3e50;
}
button {
background-color: rgba(0, 0, 0, 0.3);
}
::placeholder {
color: #95a5a6;
}
a {
color: #16a085;
}
a:hover {
color: cc#2ecc71;
}
input {
background-color: rgba(0, 0, 0, 0.15);
}
input:focus {
opacity: 0.8;
box-shadow: 0 0.1rem 1rem rgba(22, 160, 133, 0.1);
}
#root-frame { #root-frame {
position: fixed; position: fixed;
left: 0; left: 0;
@ -17,22 +66,11 @@
} }
.theme-default #top-bar { .theme-default #top-bar {
background: rgba(255, 255, 255, 0.9);
backdrop-filter: blur(9.5px);
color: #16a085;
padding: 1rem 2rem 1rem 2rem; padding: 1rem 2rem 1rem 2rem;
-webkit-backdrop-filter: blur(9.5px);
position: relative; position: relative;
z-index: 2; z-index: 2;
} backdrop-filter: blur(9.5px);
-webkit-backdrop-filter: blur(9.5px);
.theme-default #topbar-user-info {
color: #697384;
margin-right: 1rem;
}
.theme-default #top-bar button {
min-width: 7rem;
} }
.theme-default #top-menu { .theme-default #top-menu {

View file

@ -16,8 +16,8 @@
<script src="/static/js/react-dom.production.min.js?v=16.8.6"></script> <script src="/static/js/react-dom.production.min.js?v=16.8.6"></script>
<script src="/static/js/immutable.min.js?v=4.0.0-rc.12"></script> <script src="/static/js/immutable.min.js?v=4.0.0-rc.12"></script>
<link rel="stylesheet" href="/static/css/reset.css"> <link rel="stylesheet" href="/static/css/reset.css">
<link rel="stylesheet" href="/static/css/white.css">
<link rel="stylesheet" href="/static/css/default.css"> <link rel="stylesheet" href="/static/css/default.css">
<link rel="stylesheet" href="/static/css/white.css">
<!-- <link <!-- <link
rel="apple-touch-icon" rel="apple-touch-icon"
sizes="57x57" sizes="57x57"

View file

@ -74,7 +74,7 @@ export class Tabs extends React.Component<Props, State, {}> {
)} )}
</span>, </span>,
])} ])}
childrenStyles={List([{ flex: "30%" }, { flex: "70%" }])} childrenStyles={List([{}, {}, {}])}
/> />
</button> </button>
); );

View file

@ -11,7 +11,6 @@ import { LoginProps } from "./pane_login";
import { Layers } from "./layers"; import { Layers } from "./layers";
import { AdminProps } from "./pane_admin"; import { AdminProps } from "./pane_admin";
import { TopBar } from "./topbar"; import { TopBar } from "./topbar";
import { roleVisitor } from "../client";
export const controlName = "panelTabs"; export const controlName = "panelTabs";
export interface Props { export interface Props {
@ -25,7 +24,7 @@ export interface Props {
update?: (updater: (prevState: ICoreState) => ICoreState) => void; update?: (updater: (prevState: ICoreState) => ICoreState) => void;
} }
export interface State { } export interface State {}
export class RootFrame extends React.Component<Props, State, {}> { export class RootFrame extends React.Component<Props, State, {}> {
constructor(p: Props) { constructor(p: Props) {
super(p); super(p);
@ -88,17 +87,17 @@ export class RootFrame extends React.Component<Props, State, {}> {
filesPanel: { filesPanel: {
name: "RiFolder2Fill", name: "RiFolder2Fill",
size: "1.6rem", size: "1.6rem",
color: "cyan1", color: "highlight",
}, },
uploadingsPanel: { uploadingsPanel: {
name: "RiUploadCloudFill", name: "RiUploadCloudFill",
size: "1.6rem", size: "1.6rem",
color: "cyan1", color: "highlight",
}, },
sharingsPanel: { sharingsPanel: {
name: "RiShareBoxLine", name: "RiShareBoxLine",
size: "1.6rem", size: "1.6rem",
color: "cyan1", color: "highlight",
}, },
})} })}
ui={this.props.ui} ui={this.props.ui}

View file

@ -27,7 +27,7 @@ import { UploadEntry, UploadState } from "../worker/interface";
import { Up } from "../worker/upload_mgr"; import { Up } from "../worker/upload_mgr";
import { alertMsg } from "../common/env"; import { alertMsg } from "../common/env";
import { controlName as panelTabs } from "./root_frame"; import { controlName as panelTabs } from "./root_frame";
import { errUpdater, errServer } from "../common/errors"; import { errServer } from "../common/errors";
import { ErrorLogger } from "../common/log_error"; import { ErrorLogger } from "../common/log_error";
import { import {
settingsTabsCtrl, settingsTabsCtrl,

View file

@ -32,49 +32,30 @@ export class TopBar extends React.Component<Props, State, {}> {
return; return;
} }
return updater() const status = await updater().logout();
.logout() if (status !== "") {
.then((status: string) => {
if (status === "") {
const params = new URLSearchParams(
document.location.search.substring(1)
);
return updater().initAll(params);
} else {
alertMsg(this.props.msg.pkg.get("login.logout.fail")); alertMsg(this.props.msg.pkg.get("login.logout.fail"));
return;
} }
})
.then(() => {
return this.refreshCaptcha();
})
.then(() => {
this.props.update(updater().updateFilesInfo);
this.props.update(updater().updateUploadingsInfo);
this.props.update(updater().updateSharingsInfo);
this.props.update(updater().updateLogin);
this.props.update(updater().updateAdmin);
this.props.update(updater().updateUI);
this.props.update(updater().updateMsg);
});
};
refreshCaptcha = async () => { const params = new URLSearchParams(document.location.search.substring(1));
return updater() const initStatus = await updater().initAll(params);
.getCaptchaID() if (initStatus !== "") {
.then(() => { alertMsg(this.props.msg.pkg.get("op.fail"));
this.props.update(updater().updateLogin); return;
}); }
this.props.update(updater().updateAll);
}; };
render() { render() {
const showLogin = this.props.login.authed ? "" : "hidden"; const loginPanelClass = this.props.login.authed ? "" : "hidden";
const showSettings = const settingsPanelClass =
this.props.ui.control.controls.get(settingsDialogCtrl) === ctrlHidden this.props.ui.control.controls.get(settingsDialogCtrl) === ctrlHidden
? "hidden" ? "hidden"
: ""; : "";
return ( return (
<div id="top-bar"> <div id="top-bar" className="highlight-font light-bg">
<Flexbox <Flexbox
children={List([ children={List([
<a <a
@ -96,17 +77,19 @@ export class TopBar extends React.Component<Props, State, {}> {
children={List([ children={List([
<button <button
onClick={this.openSettings} onClick={this.openSettings}
className={`margin-r-m ${showSettings}`} className={`margin-r-m ${settingsPanelClass}`}
> >
{this.props.msg.pkg.get("settings")} {this.props.msg.pkg.get("settings")}
{/* {getIcon("RiSettings4Line", "1.8rem", "cyan1")} */}
</button>, </button>,
<button onClick={this.logout} className={`${showLogin}`}> <button onClick={this.logout} className={`${loginPanelClass}`}>
{this.props.msg.pkg.get("login.logout")} {this.props.msg.pkg.get("login.logout")}
</button>, </button>,
])} ])}
childrenStyles={List([{}, {}, {}, {}])} childrenStyles={List([
{ flex: "0 0 auto" },
{ flex: "0 0 auto" },
])}
/>, />,
])} ])}
childrenStyles={List([ childrenStyles={List([

View file

@ -3,6 +3,7 @@ import { Set } from "immutable";
export const colors = Set<string>([ export const colors = Set<string>([
"blue0", "blue0",
"blue1", "blue1",
"blue2",
"cyan0", "cyan0",
"cyan1", "cyan1",
"purple0", "purple0",
@ -13,6 +14,7 @@ export const colors = Set<string>([
"yellow1", "yellow1",
"yellow2", "yellow2",
"yellow3", "yellow3",
"yellow3",
"green0", "green0",
"green1", "green1",
"green2", "green2",
@ -26,6 +28,11 @@ export const colors = Set<string>([
"black", "black",
"black0", "black0",
"black1", "black1",
"dark",
"light",
"normal",
"highlight",
"error",
]); ]);
export function colorClass(name: string): string { export function colorClass(name: string): string {