Add Card components
This commit is contained in:
5
src/components/Card/Card.tsx
Normal file
5
src/components/Card/Card.tsx
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
import style from "./style.module.css";
|
||||||
|
|
||||||
|
export default function Card({ active, children }) {
|
||||||
|
return <div className={style.card}>{children}</div>;
|
||||||
|
}
|
||||||
14
src/components/Card/style.module.css
Normal file
14
src/components/Card/style.module.css
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
.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;
|
||||||
|
margin: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cardContent {
|
||||||
|
padding: 1px 100px 30px 100px;
|
||||||
|
}
|
||||||
16
src/components/CardHeader/CardHeader.tsx
Normal file
16
src/components/CardHeader/CardHeader.tsx
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
import style from "./style.module.css";
|
||||||
|
|
||||||
|
export default function CardHeader({ icon, content, active = false }) {
|
||||||
|
let containerClass = style.container;
|
||||||
|
if (active) {
|
||||||
|
containerClass += " " + style.active;
|
||||||
|
}
|
||||||
|
return (
|
||||||
|
<div className={containerClass}>
|
||||||
|
<div className={style.title}>
|
||||||
|
<div className={style.icon}>{icon}</div>
|
||||||
|
<div className={style.content}>{content}</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
27
src/components/CardHeader/style.module.css
Normal file
27
src/components/CardHeader/style.module.css
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
.container {
|
||||||
|
height: 28px;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
margin: 2px;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
color: #c0c0c0;
|
||||||
|
background-color: #808080;
|
||||||
|
}
|
||||||
|
|
||||||
|
.active {
|
||||||
|
color: white;
|
||||||
|
background-color: #000082;
|
||||||
|
}
|
||||||
|
|
||||||
|
.title {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
font-weight: bold;
|
||||||
|
gap: 7px;
|
||||||
|
padding-left: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.icon {
|
||||||
|
font-size: 10pt;
|
||||||
|
}
|
||||||
@@ -1,5 +1,7 @@
|
|||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
|
|
||||||
|
import Card from "@/components/Card/Card";
|
||||||
|
import CardHeader from "@/components/CardHeader/CardHeader";
|
||||||
import Datetime from "@/components/Datetime/Datetime";
|
import Datetime from "@/components/Datetime/Datetime";
|
||||||
import Flatastic from "@/components/Flatastic/Flatastic";
|
import Flatastic from "@/components/Flatastic/Flatastic";
|
||||||
import Footer from "@/components/Footer/Footer";
|
import Footer from "@/components/Footer/Footer";
|
||||||
@@ -10,7 +12,8 @@ import style from "./style.module.css";
|
|||||||
|
|
||||||
export default function Dashboard() {
|
export default function Dashboard() {
|
||||||
const schemes = [style.day, style.evening, style.night];
|
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
|
// change background color based on time of day
|
||||||
const time = useEffect(() => {
|
const time = useEffect(() => {
|
||||||
@@ -19,11 +22,11 @@ export default function Dashboard() {
|
|||||||
let d = new Date();
|
let d = new Date();
|
||||||
let hour = d.getHours();
|
let hour = d.getHours();
|
||||||
if (hour >= 7 && hour < 16) {
|
if (hour >= 7 && hour < 16) {
|
||||||
setScheme(style.day);
|
setSchemeIndex(0);
|
||||||
} else if (hour < 23) {
|
} else if (hour >= 16 && hour < 23) {
|
||||||
setScheme(style.evening);
|
setSchemeIndex(1);
|
||||||
} else {
|
} else {
|
||||||
setScheme(style.night);
|
setSchemeIndex(2);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
20 * 60 * 1000,
|
20 * 60 * 1000,
|
||||||
@@ -36,33 +39,27 @@ export default function Dashboard() {
|
|||||||
return (
|
return (
|
||||||
<div className={`${style.dashboard} ${scheme}`}>
|
<div className={`${style.dashboard} ${scheme}`}>
|
||||||
<div className={style.cardWrapper}>
|
<div className={style.cardWrapper}>
|
||||||
<div className={style.card}>
|
<Card>
|
||||||
<div className={style.cardHeaderInactive}>🚊 Timetable</div>
|
<CardHeader icon="🚊" content="Timetable" />
|
||||||
<div className={style.cardContent}>
|
<Timetable />
|
||||||
<Timetable />
|
</Card>
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div className={style.clock}>
|
<div className={style.small}>
|
||||||
<div className={style.card}>
|
<Card>
|
||||||
<div className={style.cardHeaderInactive}>🕐 Clock</div>
|
<CardHeader icon="🕐" content="Clock" />
|
||||||
<Datetime />
|
<Datetime />
|
||||||
</div>
|
</Card>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className={style.card}>
|
<Card>
|
||||||
<div className={style.terminal}>
|
<CardHeader icon="🔔" content="Terminal" active={true} />
|
||||||
<div className={style.cardHeader}>🔔 Terminal</div>
|
<Terminal />
|
||||||
<Terminal />
|
</Card>
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div className={style.card}>
|
<Card>
|
||||||
<div className={style.cardHeaderInactive}>🧹 Flatastic</div>
|
<CardHeader icon="🧹" content="Flatastic" />
|
||||||
<div className={style.cardContent}>
|
<Flatastic />
|
||||||
<Flatastic />
|
</Card>
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className={style.footer}>
|
<div className={style.footer}>
|
||||||
|
|||||||
@@ -29,46 +29,12 @@
|
|||||||
justify-content: flex-start;
|
justify-content: flex-start;
|
||||||
}
|
}
|
||||||
|
|
||||||
.card {
|
.small {
|
||||||
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 {
|
|
||||||
width: 45%;
|
width: 45%;
|
||||||
<<<<<<< HEAD
|
|
||||||
=======
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.terminal {
|
.terminal {
|
||||||
>>>>>>> 115a228 (Make dashboard change background based on time of day)
|
margin: 2px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.footer {
|
.footer {
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ export default function Flatastic() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div className={style.container}>
|
||||||
<h1>Chores</h1>
|
<h1>Chores</h1>
|
||||||
<ul className={style.choreList}>{choresRender}</ul>
|
<ul className={style.choreList}>{choresRender}</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,3 +1,7 @@
|
|||||||
|
.container {
|
||||||
|
padding: 1px 100px 30px 100px;
|
||||||
|
}
|
||||||
|
|
||||||
.choreList {
|
.choreList {
|
||||||
list-style-type: none;
|
list-style-type: none;
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|||||||
@@ -84,9 +84,8 @@ export default function Terminal() {
|
|||||||
</div>
|
</div>
|
||||||
<div className={style.msg}>{text}</div>
|
<div className={style.msg}>{text}</div>
|
||||||
<div className={style.input}>
|
<div className={style.input}>
|
||||||
<span className={style.prompt}>
|
<span className={style.prompt}>[sus@home ~/hallway]{"$"}</span>
|
||||||
[sus@home ~/hallway]{"$"}
|
{" █"}
|
||||||
</span>{" "}
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ export default function Timetable() {
|
|||||||
}, [fetchTimetable]);
|
}, [fetchTimetable]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={style.wrapper}>
|
<div className={style.container}>
|
||||||
<h1>Departures</h1>
|
<h1>Departures</h1>
|
||||||
<DepartureList
|
<DepartureList
|
||||||
departures={pStreet.departureList}
|
departures={pStreet.departureList}
|
||||||
|
|||||||
@@ -0,0 +1,3 @@
|
|||||||
|
.container {
|
||||||
|
padding: 1px 100px 30px 100px;
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user