feat(ui): add ui props
This commit is contained in:
parent
b16f6e54d5
commit
20b1a0b411
3 changed files with 26 additions and 2 deletions
|
@ -17,12 +17,21 @@ export interface MsgProps {
|
||||||
lan: string;
|
lan: string;
|
||||||
pkg: Map<string, string>;
|
pkg: Map<string, string>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface UIProps {
|
||||||
|
// background: url("/static/img/textured_paper.png") repeat fixed center;
|
||||||
|
wallpaper: string;
|
||||||
|
repeat: string;
|
||||||
|
position: string;
|
||||||
|
align: string;
|
||||||
|
}
|
||||||
export interface ICoreState {
|
export interface ICoreState {
|
||||||
isVertical: boolean;
|
isVertical: boolean;
|
||||||
browser: BrowserProps;
|
browser: BrowserProps;
|
||||||
panes: PanesProps;
|
panes: PanesProps;
|
||||||
login: LoginProps;
|
login: LoginProps;
|
||||||
admin: AdminProps;
|
admin: AdminProps;
|
||||||
|
ui: UIProps;
|
||||||
msg: MsgProps;
|
msg: MsgProps;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -71,6 +80,12 @@ export function initState(): ICoreState {
|
||||||
lan: "en_US",
|
lan: "en_US",
|
||||||
pkg: MsgPackage.get("en_US"),
|
pkg: MsgPackage.get("en_US"),
|
||||||
},
|
},
|
||||||
|
ui: {
|
||||||
|
wallpaper: "",
|
||||||
|
repeat: "",
|
||||||
|
position: "",
|
||||||
|
align: "",
|
||||||
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import * as React from "react";
|
import * as React from "react";
|
||||||
|
|
||||||
import { ICoreState, MsgProps } from "./core_state";
|
import { ICoreState, MsgProps, UIProps } from "./core_state";
|
||||||
import { Browser, BrowserProps } from "./browser";
|
import { Browser, BrowserProps } from "./browser";
|
||||||
import { LoginProps } from "./pane_login";
|
import { LoginProps } from "./pane_login";
|
||||||
import { Panes, PanesProps } from "./panes";
|
import { Panes, PanesProps } from "./panes";
|
||||||
|
@ -13,6 +13,7 @@ export interface Props {
|
||||||
admin: AdminProps;
|
admin: AdminProps;
|
||||||
login: LoginProps;
|
login: LoginProps;
|
||||||
msg: MsgProps;
|
msg: MsgProps;
|
||||||
|
ui: UIProps;
|
||||||
update?: (updater: (prevState: ICoreState) => ICoreState) => void;
|
update?: (updater: (prevState: ICoreState) => ICoreState) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,9 +24,16 @@ export class RootFrame extends React.Component<Props, State, {}> {
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
const wallpaperStyle =
|
||||||
|
this.props.ui.wallpaper !== ""
|
||||||
|
? {
|
||||||
|
background: `url("${this.props.ui.wallpaper}") ${this.props.ui.repeat} ${this.props.ui.position} ${this.props.ui.align}`,
|
||||||
|
}
|
||||||
|
: {};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="theme-white desktop">
|
<div className="theme-white desktop">
|
||||||
<div id="bg" className="bg bg-img font-m">
|
<div id="bg" className="bg bg-img font-m" style={wallpaperStyle}>
|
||||||
<Panes
|
<Panes
|
||||||
panes={this.props.panes}
|
panes={this.props.panes}
|
||||||
login={this.props.login}
|
login={this.props.login}
|
||||||
|
|
|
@ -122,6 +122,7 @@ export class StateMgr extends React.Component<Props, State, {}> {
|
||||||
panes={this.state.panes}
|
panes={this.state.panes}
|
||||||
login={this.state.login}
|
login={this.state.login}
|
||||||
admin={this.state.admin}
|
admin={this.state.admin}
|
||||||
|
ui={this.state.ui}
|
||||||
update={this.update}
|
update={this.update}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue