Add Card components
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
import { useEffect, useState } from "react";
|
||||
|
||||
import Card from "@/components/Card/Card";
|
||||
import CardHeader from "@/components/CardHeader/CardHeader";
|
||||
import Datetime from "@/components/Datetime/Datetime";
|
||||
import Flatastic from "@/components/Flatastic/Flatastic";
|
||||
import Footer from "@/components/Footer/Footer";
|
||||
@@ -10,7 +12,8 @@ import style from "./style.module.css";
|
||||
|
||||
export default function Dashboard() {
|
||||
const schemes = [style.day, style.evening, style.night];
|
||||
const [scheme, setScheme] = useState(style.day);
|
||||
const [schemeIndex, setSchemeIndex] = useState(0);
|
||||
const scheme = schemes[schemeIndex];
|
||||
|
||||
// change background color based on time of day
|
||||
const time = useEffect(() => {
|
||||
@@ -19,11 +22,11 @@ export default function Dashboard() {
|
||||
let d = new Date();
|
||||
let hour = d.getHours();
|
||||
if (hour >= 7 && hour < 16) {
|
||||
setScheme(style.day);
|
||||
} else if (hour < 23) {
|
||||
setScheme(style.evening);
|
||||
setSchemeIndex(0);
|
||||
} else if (hour >= 16 && hour < 23) {
|
||||
setSchemeIndex(1);
|
||||
} else {
|
||||
setScheme(style.night);
|
||||
setSchemeIndex(2);
|
||||
}
|
||||
},
|
||||
20 * 60 * 1000,
|
||||
@@ -36,33 +39,27 @@ export default function Dashboard() {
|
||||
return (
|
||||
<div className={`${style.dashboard} ${scheme}`}>
|
||||
<div className={style.cardWrapper}>
|
||||
<div className={style.card}>
|
||||
<div className={style.cardHeaderInactive}>🚊 Timetable</div>
|
||||
<div className={style.cardContent}>
|
||||
<Timetable />
|
||||
</div>
|
||||
</div>
|
||||
<Card>
|
||||
<CardHeader icon="🚊" content="Timetable" />
|
||||
<Timetable />
|
||||
</Card>
|
||||
|
||||
<div className={style.clock}>
|
||||
<div className={style.card}>
|
||||
<div className={style.cardHeaderInactive}>🕐 Clock</div>
|
||||
<div className={style.small}>
|
||||
<Card>
|
||||
<CardHeader icon="🕐" content="Clock" />
|
||||
<Datetime />
|
||||
</div>
|
||||
</Card>
|
||||
</div>
|
||||
|
||||
<div className={style.card}>
|
||||
<div className={style.terminal}>
|
||||
<div className={style.cardHeader}>🔔 Terminal</div>
|
||||
<Terminal />
|
||||
</div>
|
||||
</div>
|
||||
<Card>
|
||||
<CardHeader icon="🔔" content="Terminal" active={true} />
|
||||
<Terminal />
|
||||
</Card>
|
||||
|
||||
<div className={style.card}>
|
||||
<div className={style.cardHeaderInactive}>🧹 Flatastic</div>
|
||||
<div className={style.cardContent}>
|
||||
<Flatastic />
|
||||
</div>
|
||||
</div>
|
||||
<Card>
|
||||
<CardHeader icon="🧹" content="Flatastic" />
|
||||
<Flatastic />
|
||||
</Card>
|
||||
</div>
|
||||
|
||||
<div className={style.footer}>
|
||||
|
||||
@@ -29,46 +29,12 @@
|
||||
justify-content: flex-start;
|
||||
}
|
||||
|
||||
.card {
|
||||
flex-direction: column;
|
||||
justify-content: flex-start;
|
||||
background-color: #c0c0c0;
|
||||
border-top: 2px solid white;
|
||||
border-left: 2px solid white;
|
||||
border-bottom: 2px solid #828282;
|
||||
border-right: 2px solid #828282;
|
||||
}
|
||||
|
||||
.cardContent {
|
||||
padding: 1px 100px 30px 100px;
|
||||
}
|
||||
|
||||
.cardHeader {
|
||||
height: 30px;
|
||||
color: white;
|
||||
background-color: #000082;
|
||||
text-align: left;
|
||||
padding-left: 5px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.cardHeaderInactive {
|
||||
height: 30px;
|
||||
color: #c0c0c0;
|
||||
background-color: #808080;
|
||||
text-align: left;
|
||||
padding-left: 5px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.clock {
|
||||
.small {
|
||||
width: 45%;
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
}
|
||||
|
||||
.terminal {
|
||||
>>>>>>> 115a228 (Make dashboard change background based on time of day)
|
||||
margin: 2px;
|
||||
}
|
||||
|
||||
.footer {
|
||||
|
||||
Reference in New Issue
Block a user