Compare commits

..

3 commits

Author SHA1 Message Date
afdc95d5c6 Merge pull request 'Darkmode' (#9) from Darkmode into main
Reviewed-on: #9
2024-09-13 21:30:03 +02:00
1e19501dab fix(vars): remove unused 2024-09-13 21:28:46 +02:00
2016a8619d feat(Darkmode): add Darkmode 2024-09-13 21:28:03 +02:00
11 changed files with 215 additions and 160 deletions

View file

@ -6,7 +6,6 @@ import "./App.css";
import { Main } from "./pages";
import { Library } from "./pages/Library";
import { Book } from "./pages/Book";
import { primary } from "./colors";
import { ActiveModalProps } from "./shared/components/modals/types";
export const AuthContext = createContext<{
@ -50,7 +49,6 @@ function App() {
style={{
height: "100vh",
width: "100vw",
backgroundColor: primary,
fontFamily: "New Amsterdam",
overflow: "scroll",
}}

View file

@ -0,0 +1,5 @@
export const primary = "#5e6268";
export const primaryRGBA = "rgba(83,86,91, 0.8)";
export const secondary = "#5f5e68";
export const tertiary = "#5e6768";
export const danger = "#685e62";

View file

@ -12,49 +12,208 @@ body {
}
}
#bootstrap-overrides .form-select .form-control {
background-color: #f2f2e8 !important;
border-color: #f2f2e8 !important;
#bootstrap-overrides {
background-color: #f2f3f4;
color: #5e6268;
.btn-primary {
background-color: #5e6268;
color: #f2f3f4;
border: 2px solid #5e6268;
}
form-control {
background-color: #f2f2e8 !important;
border-color: #5e6268 !important;
}
.form-select .form-control {
background-color: #f2f2e8 !important;
border-color: #f2f2e8 !important;
}
.dropdown-toggle::after {
display: none;
}
.form-label {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto",
"Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans",
"Helvetica Neue", sans-serif !important;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
letter-spacing: normal;
}
.table > :not(caption) > * > * {
background-color: #f2f2e8 !important;
color: #5e6268 !important;
}
table {
letter-spacing: 0.25em;
}
.bg-primary {
background-color: #f2f3f4 !important;
}
.modal-content {
background-color: #f2f3f4 !important;
border-radius: 10px;
}
.modal-body {
background-color: #f2f3f4 !important;
border-radius: 0px 0px 10px 10px;
}
.modal-header {
background-color: #f2f3f4 !important;
border-radius: 10px 10px 0px 0px;
border-bottom: none;
}
.dropdown button {
background-color: #f2f2e8 !important;
color: #5e6268 !important;
border: 2px solid #5e6268;
}
.dropdown-menu {
background-color: #f2f2e8 !important;
color: #5e6268 !important;
border: 2px solid #f2f2e8;
}
.danger {
background-color: #f9a9ab !important;
}
.page-link {
color: #5e6268 !important;
border: 2px solid #5e6268 !important;
background-color: transparent !important;
}
.active > .page-link {
background-color: #5e6268 !important;
color: #f2f3f4 !important;
}
.pagination {
margin-top: 10px !important;
li {
min-width: 40px;
}
}
}
#bootstrap-overrides .dropdown-toggle::after {
display: none;
}
@media (prefers-color-scheme: dark) {
#bootstrap-overrides {
background-color: #5e6268;
color: #f2f3f4;
#bootstrap-overrides .form-label {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen",
"Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue",
sans-serif !important;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
letter-spacing: normal;
}
.btn-primary {
background-color: #f2f3f4;
color: #5e6268;
border: 2px solid #5e6268;
}
#bootstrap-overrides table {
letter-spacing: 0.25em;
}
.form-control {
background-color: #f2f2e8 !important;
border-color: #5e6268 !important;
border-right: none;
}
#bootstrap-overrides .bg-primary {
background-color: #f2f3f4 !important;
}
.form-select .form-control {
background-color: #f2f2e8 !important;
border-color: #f2f2e8 !important;
}
#bootstrap-overrides .modal-body {
background-color: #f2f3f4 !important;
}
.dropdown-toggle::after {
display: none;
}
#bootstrap-overrides .danger {
background-color: #f9a9ab !important;
}
.form-label {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto",
"Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans",
"Helvetica Neue", sans-serif !important;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
letter-spacing: normal;
}
#bootstrap-overrides .page-link {
color: black !important;
border: 2px solid black !important;
background-color: transparent !important;
}
.table > :not(caption) > * > * {
background-color: #5e6268 !important;
color: #f2f2e8 !important;
}
#bootstrap-overrides .active > .page-link {
background-color: black !important;
color: #f2f3f4 !important;
table {
letter-spacing: 0.25em;
}
.bg-primary {
background-color: #5e6268 !important;
}
.dropdown button {
background-color: #f2f2e8 !important;
color: #5e6268 !important;
}
.dropdown-menu {
background-color: #5e6268 !important;
border: 2px solid #5e6268;
}
.dropdown-item {
color: #f2f2e8 !important;
svg {
color: #f2f2e8 !important;
}
}
.dropdown-item:hover {
color: #5e6268 !important;
background-color: #f2f2e8 !important;
}
.modal-content {
background-color: #5e6268 !important;
border-radius: 10px;
}
.modal-body {
background-color: #5e6268 !important;
border-radius: 0px 0px 10px 10px;
}
.modal-header {
background-color: #5e6268 !important;
border-radius: 10px 10px 0px 0px;
border-bottom: none;
}
.danger {
background-color: #c94414 !important;
}
.page-link {
color: #f2f3f4 !important;
border: 2px solid #f2f3f4 !important;
background-color: transparent !important;
}
.active > .page-link {
background-color: #f2f3f4 !important;
color: #5e6268 !important;
}
.pagination {
margin-top: 10px !important;
}
}
}
code {

View file

@ -2,7 +2,8 @@ import { Badge, Dropdown } from "react-bootstrap";
import { Book } from "../../../types/Book";
import { ImBin, ImBook, ImBoxAdd, ImBoxRemove, ImMenu } from "react-icons/im";
import { useMutation } from "@tanstack/react-query";
import { secondary } from "../../../colors";
import * as colors from "../../../colors";
import * as dark from "../../../darkmodeColors";
import { ModalContextType } from "../../../App";
import { modalTypes } from "../../../shared/components/modals/types";
import { useCallback } from "react";
@ -44,11 +45,7 @@ export const Actions = ({
return (
<>
<Dropdown>
<Dropdown.Toggle
variant='success'
id='dropdown-basic'
style={{ backgroundColor: secondary, border: "2px solid black" }}
>
<Dropdown.Toggle variant='success' id='dropdown-basic'>
<ImMenu size={25} color='black' />
</Dropdown.Toggle>
@ -59,14 +56,7 @@ export const Actions = ({
className='d-flex'
onClick={() => setActiveModal({ type: bookModal, book, onClose })}
>
<Badge
pill
className='ml-2 d-flex mr-2'
style={{
border: "2px solid black",
backgroundColor: "transparent",
}}
>
<Badge pill className='ml-2 d-flex mr-2'>
<ImBook size={25} color='black' className='m-auto' />
</Badge>
<p className='m-auto' style={{ paddingLeft: "10px" }}>
@ -87,13 +77,7 @@ export const Actions = ({
})
}
>
<Badge
pill
className='ml-2 d-flex mr-2'
style={{
border: "2px solid black",
}}
>
<Badge pill className='ml-2 d-flex mr-2'>
<ImBoxRemove size={25} color='black' className='m-auto' />
</Badge>{" "}
<p className='m-auto' style={{ paddingLeft: "10px" }}>
@ -130,13 +114,7 @@ export const Actions = ({
setActiveModal({ type: del, uuid: book.uuid, onClose })
}
>
<Badge
pill
className='ml-2 d-flex danger mr-2'
style={{
border: "2px solid black",
}}
>
<Badge pill className='ml-2 d-flex danger mr-2'>
<ImBin size={25} color='black' className='m-auto' />
</Badge>{" "}
<p className='m-auto' style={{ paddingLeft: "10px" }}>

View file

@ -13,7 +13,6 @@ import { TfiKey } from "react-icons/tfi";
import { Link, useNavigate } from "react-router-dom";
import { Book } from "../../types/Book";
import { secondary } from "../../colors";
import { useAuth } from "../../shared/utils/useAuthentication";
import { ModalContext } from "../../App";
import { modalTypes } from "../../shared/components/modals/types";
@ -95,16 +94,12 @@ export const Main = (): React.JSX.Element => {
onChange={(ev) => setTitle(ev.target.value)}
style={{
borderRadius: "20px 0px 0px 20px",
border: "2px solid black",
borderRight: "none",
}}
/>
<Button
style={{
borderRadius: "0px 5px 5px 0px",
backgroundColor: secondary,
color: "black",
border: "2px solid black",
}}
className='mr-2'
disabled={activeModal?.type === scanner || isFetching}
@ -135,9 +130,6 @@ export const Main = (): React.JSX.Element => {
<Button
style={{
borderRadius: "5px",
backgroundColor: secondary,
color: "black",
border: "2px solid black",
marginLeft: "auto",
marginRight: "10px",
}}
@ -151,9 +143,6 @@ export const Main = (): React.JSX.Element => {
<Button
style={{
borderRadius: "5px",
backgroundColor: secondary,
color: "black",
border: "2px solid black",
marginLeft: "auto",
marginRight: "10px",
}}
@ -174,9 +163,6 @@ export const Main = (): React.JSX.Element => {
<Button
style={{
borderRadius: "5px",
backgroundColor: secondary,
color: "black",
border: "2px solid black",
}}
>
<ImBooks /> Browse library{" "}
@ -186,9 +172,6 @@ export const Main = (): React.JSX.Element => {
<Button
style={{
borderRadius: "5px",
backgroundColor: secondary,
color: "black",
border: "2px solid black",
marginRight: "auto",
marginLeft: "10px",
}}

View file

@ -2,7 +2,6 @@ import { useCallback, useContext } from "react";
import { Button, Col, Form, Modal, Row } from "react-bootstrap";
import { useForm, useWatch } from "react-hook-form";
import { TfiKey } from "react-icons/tfi";
import { primaryRGBA, primary, secondary } from "../../../colors";
import { ModalHeader } from "./ModalHeader";
import { AuthContext } from "../../../App";
import { AuthModalProps } from "./types";
@ -71,12 +70,7 @@ export const AuthenticationModal = ({
);
return (
<Modal
show={open}
onHide={onClose}
style={{ backgroundColor: primaryRGBA }}
centered
>
<Modal show={open} onHide={onClose} centered>
<ModalHeader
onClose={onClose}
title={isUpdate ? "Set new Admin key" : "Admin Login"}
@ -84,9 +78,7 @@ export const AuthenticationModal = ({
/>
<Modal.Body
style={{
border: "2px solid black",
borderTop: "none",
backgroundColor: primary,
}}
>
<Form
@ -141,9 +133,6 @@ export const AuthenticationModal = ({
{!isUpdate && (
<Form.Group as={Row} className='mb-2'>
<Col sm='4'>
<Form.Label>Password</Form.Label>
</Col>
<Col>
<Form.Control
{...register("password", {
@ -166,9 +155,6 @@ export const AuthenticationModal = ({
<Button
style={{
borderRadius: "5px",
backgroundColor: secondary,
color: "black",
border: "2px solid black",
marginLeft: "auto",
marginRight: "10px",
}}

View file

@ -5,7 +5,6 @@ import { ModalHeader } from "./ModalHeader";
import { useForm, useWatch } from "react-hook-form";
import { Book, bookShelfs } from "../../../types/Book";
import { useScanner } from "../../utils/useScanner";
import { primary, primaryRGBA, secondary } from "../../../colors";
import { BookModalProps } from "./types";
type BookForm = Pick<Book, "isbn" | "title" | "shelf" | "published">;
@ -94,12 +93,7 @@ export const BookModal = ({
);
return (
<Modal
show={open}
onHide={onClose}
style={{ backgroundColor: primaryRGBA }}
centered
>
<Modal show={open} onHide={onClose} centered>
<ModalHeader
onClose={onClose}
title={`${!!book ? "Edit" : "Add new"} Book`}
@ -107,9 +101,7 @@ export const BookModal = ({
/>
<Modal.Body
style={{
border: "2px solid black",
borderTop: "none",
backgroundColor: primary,
}}
>
{!showScanner && (
@ -136,9 +128,6 @@ export const BookModal = ({
<Button
style={{
borderRadius: "0px 5px 5px 0px",
backgroundColor: secondary,
color: "black",
border: "2px solid black",
}}
className='mr-2 pt-0'
disabled={showScanner}
@ -237,9 +226,6 @@ export const BookModal = ({
<Button
style={{
borderRadius: "5px",
backgroundColor: secondary,
color: "black",
border: "2px solid black",
marginLeft: "auto",
marginRight: "10px",
}}
@ -260,7 +246,6 @@ export const BookModal = ({
className='drawingBuffer w-100 position-absolute'
style={{
height: "100%",
border: "2px solid black",
}}
/>
</div>

View file

@ -3,7 +3,7 @@ import { Alert, Button, Col, Form, Modal, Row } from "react-bootstrap";
import { ImBoxAdd, ImBoxRemove } from "react-icons/im";
import { useForm, useWatch } from "react-hook-form";
import { Book } from "../../../types/Book";
import { primary, primaryRGBA, secondary } from "../../../colors";
import { primary, secondary } from "../../../colors";
import { ModalHeader } from "./ModalHeader";
import { CheckoutBookModalProps } from "./types";
import { AiOutlineExclamationCircle } from "react-icons/ai";
@ -68,12 +68,7 @@ export const CheckoutBookModal = ({
);
return (
<Modal
show={open}
onHide={onClose}
style={{ backgroundColor: primaryRGBA }}
centered
>
<Modal show={open} onHide={onClose} centered>
<ModalHeader
onClose={onClose}
title={`${isChechout ? "Checkout" : "Return"} book '${title}'`}
@ -87,9 +82,7 @@ export const CheckoutBookModal = ({
/>
<Modal.Body
style={{
border: "2px solid black",
borderTop: "none",
backgroundColor: primary,
}}
>
<Alert className='w-80 m-auto my-4' variant='warning'>
@ -187,9 +180,6 @@ export const CheckoutBookModal = ({
<Button
style={{
borderRadius: "5px",
backgroundColor: secondary,
color: "black",
border: "2px solid black",
marginLeft: "auto",
marginRight: "10px",
}}

View file

@ -1,5 +1,5 @@
import { Button, Modal } from "react-bootstrap";
import { primary, primaryRGBA, secondary } from "../../../colors";
import { primary, secondary } from "../../../colors";
import { ModalHeader } from "./ModalHeader";
import { ImBin } from "react-icons/im";
import { useMutation } from "@tanstack/react-query";
@ -24,12 +24,7 @@ export const DeleteBookModal = ({
});
return (
<Modal
show={open}
onHide={onClose}
style={{ backgroundColor: primaryRGBA }}
centered
>
<Modal show={open} onHide={onClose} centered>
<ModalHeader
onClose={onClose}
title={"Move to Shelf"}
@ -37,18 +32,13 @@ export const DeleteBookModal = ({
/>
<Modal.Body
style={{
border: "2px solid black",
borderTop: "none",
backgroundColor: primary,
}}
>
<div className='d-flex mx-auto mb-auto mt-2 w-100'>
<Button
style={{
borderRadius: "5px",
backgroundColor: secondary,
color: "black",
border: "2px solid black",
marginLeft: "auto",
marginRight: "10px",
}}
@ -59,9 +49,6 @@ export const DeleteBookModal = ({
<Button
style={{
borderRadius: "5px",
backgroundColor: secondary,
color: "black",
border: "2px solid black",
marginLeft: "auto",
marginRight: "10px",
}}

View file

@ -1,7 +1,6 @@
import React from "react";
import { Button, Modal } from "react-bootstrap";
import { AiOutlineClose } from "react-icons/ai";
import { primary, secondary } from "../../../colors";
export const ModalHeader = ({
title,
@ -13,13 +12,7 @@ export const ModalHeader = ({
icon?: JSX.Element;
}): React.JSX.Element => {
return (
<Modal.Header
style={{
border: "2px solid black",
borderBottom: "none",
backgroundColor: primary,
}}
>
<Modal.Header>
<Modal.Title className='w-100 d-flex' style={{ height: "fit-content" }}>
{typeof title === "string" ? (
<>
@ -34,9 +27,6 @@ export const ModalHeader = ({
<Button
className='ml-auto mr-0'
style={{
backgroundColor: secondary,
color: "black",
border: "2px solid black",
width: "fit-content",
height: "fit-content",
}}

View file

@ -1,7 +1,6 @@
import React from "react";
import React, { useContext } from "react";
import { Modal } from "react-bootstrap";
import { ImCamera } from "react-icons/im";
import { primaryRGBA } from "../../../colors";
import { useScanner } from "../../utils/useScanner";
import { ModalHeader } from "./ModalHeader";
@ -17,18 +16,13 @@ export const ScannerModal = ({
const { scannerError, setScannerRef } = useScanner({ onDetected });
return (
<Modal
show={open}
onHide={onClose}
style={{ backgroundColor: primaryRGBA }}
centered
>
<Modal show={open} onHide={onClose} centered>
<ModalHeader
onClose={onClose}
title={"Scan barcode"}
icon={<ImCamera size={50} className='ml-0 mr-auto' />}
/>
<Modal.Body style={{ border: "2px solid black", borderTop: "none" }}>
<Modal.Body>
<div
className='w-100 overflow-hidden'
ref={(ref) => setScannerRef(ref)}
@ -41,7 +35,7 @@ export const ScannerModal = ({
className='drawingBuffer w-100 position-absolute'
style={{
height: "100%",
border: "2px solid black",
border: `2px solid black`,
}}
/>
</div>