From e48611b11c3b1080cd40b1823400582d81056ac9 Mon Sep 17 00:00:00 2001 From: Vomitblood Date: Sat, 10 Aug 2024 02:43:41 +0800 Subject: [PATCH] style improvements --- src/components/Generic/FloatingDialog.tsx | 10 ++- src/components/Generic/Layout.tsx | 6 +- .../HeaderBar/Settings/Settings.tsx | 12 +-- ...ttingsTabBackground.tsx => Background.tsx} | 37 +++++--- .../{SettingsTabStyle.tsx => Style.tsx} | 86 +++++++++++++++---- .../{SettingsTabWindow.tsx => Window.tsx} | 11 +-- src/contexts/ThemeContext.tsx | 4 +- src/lib/settings.ts | 3 + src/lib/utils/color.ts | 26 ++++++ 9 files changed, 151 insertions(+), 44 deletions(-) rename src/components/HeaderBar/Settings/SettingsTabs/{SettingsTabBackground.tsx => Background.tsx} (87%) rename src/components/HeaderBar/Settings/SettingsTabs/{SettingsTabStyle.tsx => Style.tsx} (75%) rename src/components/HeaderBar/Settings/SettingsTabs/{SettingsTabWindow.tsx => Window.tsx} (83%) create mode 100644 src/lib/utils/color.ts diff --git a/src/components/Generic/FloatingDialog.tsx b/src/components/Generic/FloatingDialog.tsx index 97ded8b..26ef1ea 100644 --- a/src/components/Generic/FloatingDialog.tsx +++ b/src/components/Generic/FloatingDialog.tsx @@ -1,7 +1,8 @@ import { Close, UnfoldLess, UnfoldMore } from "@mui/icons-material"; -import { Box, IconButton, Modal, Tooltip, Typography } from "@mui/material"; +import { Box, IconButton, Modal, Tooltip, Typography, useTheme } from "@mui/material"; import { FC, ReactNode } from "react"; import { useSettings } from "../../contexts/SettingsContext"; +import { hexToRgba } from "../../lib/utils/color"; interface FloatingDialog { actionButtons?: ReactNode; @@ -28,7 +29,11 @@ export const FloatingDialog: FC = ({ title, sx, }) => { + // contexts const { settings } = useSettings(); + const theme = useTheme(); + + const { r, g, b, a } = hexToRgba(theme.palette.background.paper); return ( <> @@ -40,7 +45,8 @@ export const FloatingDialog: FC = ({ > { + // contexts const { settings } = useSettings(); + const theme = useTheme(); const [imageUrl, setImageUrl] = useState(null); @@ -23,7 +25,7 @@ export const Layout = () => { { // contexts @@ -127,19 +127,19 @@ export const Settings = () => { sx={{ p: 2 }} value="style" > - +