Files
Web-Frontend/client/src/theme.js
T
2026-06-04 15:30:01 -07:00

203 lines
5.1 KiB
JavaScript

import { defineSlotRecipe, createSystem, defaultConfig, defineConfig, defineRecipe } from "@chakra-ui/react";
// RECIPES
const headerRecipe = defineRecipe({
base: {
bg: "{base200}",
color: "text",
width: "100%",
height: "100%",
borderBottom: "1px solid",
borderBottomColor:"{border}",
display: "flex",
flexDirection: "row",
justifyContent: "space-between",
alignItems: "center",
}
});
const dashboardRecipe = defineRecipe({
base: {
bg: "{base200}"
}
});
const canvasRecipe = defineRecipe({
base: {
bg: "{base200}",
zIndex: "-1",
color: "{text}"
}
});
const sidebarRecipe = defineSlotRecipe({
slots: ["root", "close_button", "buttons", "dark_mode_button"],
base: {
root: {
bg: "{base200}",
borderRight: "1px solid",
borderColor: "{border}",
width: "100%",
height: "100%",
display: "flex",
flexDirection: "column",
justifyContent: "start",
alignItems: "start",
gap: 2,
p: 2,
},
buttons: {
bg: "transparent",
_hover: {bg: "{primaryLt}", color: "{textInverted}"},
"&.active": {bg: "{primary}", color: "{textInverted}"},
fontSize: "xl",
color: {base: "{text}"},
variant: "ghost",
width: "100%",
},
}
});
const widgetRecipe = defineSlotRecipe({
slots: ["root", "header", "canvas"],
base: {
root: {
flexDirection: "column",
gap: "1",
position: "relative",
bg: "base100",
borderRadius: "md",
p: "1",
paddingBottom: "2",
border: "1px solid",
borderColor: "{base300}",
textAlign: "center",
height: "100%",
position: "fixed"
},
header: {
flexShrink: "0",
bg: "{base300}",
color: "{text}",
cursor: "move",
borderRadius: "sm",
whiteSpace: "nowrap",
textAlign: "left",
pl: "2"
},
canvas: {
flex: "1 1 auto",
bg: "transparent",
color: "{text}",
cursor: "default",
borderRadius: "md",
overflow: "auto",
}
}
});
const config = defineConfig({
globalCss: {
".react-grid-placeholder": {
background: "#c0d2e3ff !important",
borderColor: "#a9b6c2ff !important",
boxShadow: "0 0 10px #c0d2e3ff !important",
opacity: "1 !important",
borderRadius: "5px",
_dark: {
background: "#393c3fff !important",
borderColor: "#000000ff !important",
boxShadow: "0 0 10px #16181bff !important",
opacity: "1 !important",
},
},
".react-resizable-handle-se": {
zIndex: "1",
},
"*": {
scrollbarWidth: "thin",
scrollbarColor: "#a0aec0 transparent",
_dark: {
scrollbarColor: "#474747ff transparent",
}
},
"::-webkit-scrollbar": {
width: "8px",
},
"::-webkit-scrollbar-thumb": {
backgroundColor: "rgba(100, 100, 100, 0.4)",
borderRadius: "4px",
_dark: {
backgroundColor: "rgba(35, 35, 35, 0.81)",
}
},
"::-webkit-scrollbar-track": {
background: "transparent",
},
'.leaflet-tile': {
_dark: {
filter: "invert(100%) hue-rotate(180deg) brightness(95%) contrast(90%)",
}
},
'.leaflet-control-zoom-in .leaflet-control-zoom-out .leaflet-control-attribution .leaflet-container': {
_dark: {
filter: "invert(100%) hue-rotate(180deg) brightness(95%) contrast(90%)",
}
},
'.leaflet-control-attribution': {
_dark: {
filter: "invert(100%) hue-rotate(180deg) brightness(95%) contrast(90%)",
}
},
'.leaflet-container': {
fontFamily: "georgia, system-ui, sans-serif !important",
_dark: {
filter: "invert(100%) hue-rotate(180deg) brightness(95%) contrast(90%)",
}
},
".leaflet-popup-content": {
fontFamily: "georgia, system-ui, sans-serif !important"
},
".leaflet-control a": {
fontFamily: "georgia, system-ui, sans-serif !important"
},
".leaflet-tooltip": {
fontFamily: "georgia, system-ui, sans-serif !important"
},
".react-grid-item": {
transition: "none !important"
},
},
theme: {
semanticTokens: {
colors: {
base100: { value: {base: "#f6f9faff", _dark: "#1617199e"}},
base200: { value: {base: "#e6ecf1ff", _dark: "#242424"}},
base300: { value: {base: "#d3dae4ff", _dark: "#0a0b0bff"}},
primary: { value: {base: "#2B98F8", _dark: "#2B98F8"}},
primaryLt: { value: {base: "#98cdffff", _dark: "#98cdffff"}},
secondaryBG: { value: {base: "#EDF1F1", _dark: "#121212"}},
border: {value: {base: "#000000", _dark: "#cbcbcb84"}},
text: {value: {base: "#000000", _dark: "lightgrey"}},
textInverted: {value: "white"},
icon: {value: {base: "#000000", _dark: "lightgrey"}},
},
},
tokens: {
fonts: {
body: { value: "georgia, system-ui, sans-serif" },
},
},
recipes: {
header: headerRecipe,
dashboard: dashboardRecipe,
canvas: canvasRecipe,
},
slotRecipes: {
sidebar: sidebarRecipe,
widget: widgetRecipe,
},
},
});
export const system = createSystem(defaultConfig, config);