Merge pull request #2 from FeiBam/master

add dark mode
This commit is contained in:
2023-06-25 21:06:32 +08:00
committed by GitHub
4 changed files with 133 additions and 36 deletions

14
components/MyIcon.tsx Normal file
View File

@@ -0,0 +1,14 @@
import { Component } from "preact";
import Icon from "preact-material-components/Icon";
type Props = {
show: boolean;
icon: string;
};
export default class MyIcon extends Component<Props> {
render() {
if (!this.props.show) return;
return <Icon>{this.props.icon}</Icon>;
}
}

View File

@@ -11,6 +11,7 @@ import t, { i18n_map, I18NMap } from "../server/i18n.ts";
import TaskManager from "./TaskManager.tsx";
import { initState, set_state } from "../server/state.ts";
import NewTask from "../components/NewTask.tsx";
import MyIcon from "../components/MyIcon.tsx";
export type ContainerProps = {
i18n: I18NMap;
@@ -23,6 +24,7 @@ export default class Container extends Component<ContainerProps> {
i18n_map.value = this.props.i18n;
const [display, set_display] = useState(false);
const [state, set_state1] = useState("#/");
const [darkmode, set_darkmode] = useState(false);
useEffect(() => {
initState(set_state1);
}, []);

View File

@@ -166,33 +166,29 @@ export default class TaskManager extends Component<TaskManagerProps> {
if (!this.props.show) return null;
return (
<div class="task_manager">
<div id="task_head">
<div></div>
<div class="add">
<Fab mini={true}>
<Icon
onClick={() => {
set_state(`${this.props.base}/new`);
}}
>
add
</Icon>
</Fab>
<div class="task_amounts">
<div class="mdc-theme--secondary-light">
<p>count</p>
<p>Total Task</p>
</div>
<div class="btn-success">
<p>count</p>
<p>Running</p>
</div>
<div class="btn-warning">
<p>count</p>
<p>Waiting</p>
</div>
<div class="btn-danger">
<p>count</p>
<p>Fail</p>
</div>
<div class="btn-primary">
<p>count</p>
<p>Finished</p>
</div>
</div>
<div
id="task-list"
// @ts-ignore checked
ref={ul}
>
{task_list.value.map((k) => {
const t = tasks.value.get(k);
if (t) {
return <Task task={t} />;
} else {
return <div data-id={k}></div>;
}
})}
<div class="task_details">
</div>
</div>
);

View File

@@ -1,3 +1,13 @@
body {
min-width: 100vw;
min-height: 100vh;
}
:root{
--mdc-theme-primary:#007bff;
--mdc-theme-secondary:#007bff;
}
.nav-menu {
z-index: 100;
position: fixed;
@@ -19,14 +29,12 @@
top: 64px;
}
.settings {
margin: 0 18%;
padding-top: 40px;
transition: 0.6s;
}
.settings div.text {
width: 100%;
}
@@ -79,7 +87,7 @@
align-items: center;
}
.settings .text-box .text .mdc-text-field::after {
.settings .text-box .text .mdc-text-field::after{
width: 0;
}
@@ -97,7 +105,9 @@
left: -10px;
}
@media (max-width:767px) {}
@media (max-width:767px) {
}
@media (max-width:1280px) {
.settings {
@@ -105,14 +115,89 @@
}
}
.task_manager #task_head {
.task_manager {
padding: 16px;
display: flex;
justify-content: space-between;
align-items: center;
flex-direction: column;
}
.new_task .close {
position: absolute;
right: 10px;
top: 10px;
.task_amounts {
display: flex;
height: 64px;
}
.task_amounts > div {
flex: auto;
text-align: center;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
color: aliceblue;
}
.task_amounts > div:first-child {
border-radius: 8px 0 0 8px;
background-color: black;
}
.task_amounts > div:last-child{
border-radius: 0 8px 8px 0
}
.btn-success{
background-color:#28a745
}
.btn-warning{
background-color:#ffc107
}
.btn-danger{
background-color:#dc3545
}
.btn-primary{
background-color:#007bff
}
.dark-scheme {
background: #343a40;
color: white;
}
.dark-scheme .mdc-top-app-bar {
background-color: black;
}
.dark-scheme .mdc-text-field__input{
color:white!important;
}
.dark-scheme .mdc-select__native-control {
color:white!important;
}
.dark-scheme .mdc-text-field__input {
color:white!important;
}
.dark-scheme .mdc-floating-label{
color:white!important;
}
.dark-scheme .mdc-select-item{
background-color: black!important;
}
.dark-scheme .mdc-list{
background-color:#272727;
}
.dark-scheme .mdc-list-item{
color: white;
}
.dark-scheme .mdc-notched-outline__idle{
color: white!important;
}