diff --git a/src/components/base/base-switch.tsx b/src/components/base/base-switch.tsx
new file mode 100644
index 00000000..c05c0915
--- /dev/null
+++ b/src/components/base/base-switch.tsx
@@ -0,0 +1,57 @@
+import { styled } from "@mui/material/styles";
+import { default as MuiSwitch, SwitchProps } from "@mui/material/Switch";
+
+export const Switch = styled((props: SwitchProps) => (
+
+))(({ theme }) => ({
+ width: 42,
+ height: 26,
+ padding: 0,
+ "& .MuiSwitch-switchBase": {
+ padding: 0,
+ margin: 2,
+ transitionDuration: "300ms",
+ "&.Mui-checked": {
+ transform: "translateX(16px)",
+ color: "#fff",
+ "& + .MuiSwitch-track": {
+ backgroundColor: theme.palette.primary.main,
+ opacity: 1,
+ border: 0,
+ },
+ "&.Mui-disabled + .MuiSwitch-track": {
+ opacity: 0.5,
+ },
+ },
+ "&.Mui-focusVisible .MuiSwitch-thumb": {
+ color: "#33cf4d",
+ border: "6px solid #fff",
+ },
+ "&.Mui-disabled .MuiSwitch-thumb": {
+ color:
+ theme.palette.mode === "light"
+ ? theme.palette.grey[100]
+ : theme.palette.grey[600],
+ },
+ "&.Mui-disabled + .MuiSwitch-track": {
+ opacity: theme.palette.mode === "light" ? 0.7 : 0.3,
+ },
+ },
+ "& .MuiSwitch-thumb": {
+ boxSizing: "border-box",
+ width: 22,
+ height: 22,
+ },
+ "& .MuiSwitch-track": {
+ borderRadius: 26 / 2,
+ backgroundColor: theme.palette.mode === "light" ? "#E9E9EA" : "#39393D",
+ opacity: 1,
+ transition: theme.transitions.create(["background-color"], {
+ duration: 500,
+ }),
+ },
+}));
diff --git a/src/components/base/index.ts b/src/components/base/index.ts
index 3e0e3240..57303ed6 100644
--- a/src/components/base/index.ts
+++ b/src/components/base/index.ts
@@ -4,3 +4,4 @@ export { BaseEmpty } from "./base-empty";
export { BaseLoading } from "./base-loading";
export { BaseErrorBoundary } from "./base-error-boundary";
export { Notice } from "./base-notice";
+export { Switch } from "./base-switch";
diff --git a/src/components/layout/layout-item.tsx b/src/components/layout/layout-item.tsx
index c479f6f9..71980bab 100644
--- a/src/components/layout/layout-item.tsx
+++ b/src/components/layout/layout-item.tsx
@@ -1,32 +1,49 @@
-import { alpha, ListItem, ListItemButton, ListItemText } from "@mui/material";
+import {
+ alpha,
+ ListItem,
+ ListItemButton,
+ ListItemText,
+ ListItemAvatar,
+ Avatar,
+} from "@mui/material";
import { useMatch, useResolvedPath, useNavigate } from "react-router-dom";
import type { LinkProps } from "react-router-dom";
-export const LayoutItem = (props: LinkProps) => {
- const { to, children } = props;
+interface Props {
+ to: string;
+ children: string;
+ img: string;
+}
+export const LayoutItem = (props: Props) => {
+ const { to, children, img } = props;
const resolved = useResolvedPath(to);
const match = useMatch({ path: resolved.pathname, end: true });
const navigate = useNavigate();
return (
-
+
{
const bgcolor =
mode === "light"
? alpha(primary.main, 0.15)
: alpha(primary.main, 0.35);
- const color = mode === "light" ? primary.main : primary.light;
+ const color = mode === "light" ? "#1f1f1f" : "#ffffff";
return {
"&.Mui-selected": { bgcolor },
@@ -37,6 +54,9 @@ export const LayoutItem = (props: LinkProps) => {
]}
onClick={() => navigate(to)}
>
+
+
+
diff --git a/src/components/layout/layout-traffic.tsx b/src/components/layout/layout-traffic.tsx
index 1aa3d5e3..5f522081 100644
--- a/src/components/layout/layout-traffic.tsx
+++ b/src/components/layout/layout-traffic.tsx
@@ -89,7 +89,7 @@ export const LayoutTraffic = () => {
return (
diff --git a/src/components/layout/use-custom-theme.ts b/src/components/layout/use-custom-theme.ts
index d426df1b..aa8ef942 100644
--- a/src/components/layout/use-custom-theme.ts
+++ b/src/components/layout/use-custom-theme.ts
@@ -1,6 +1,6 @@
import { useEffect, useMemo } from "react";
import { useRecoilState } from "recoil";
-import { alpha, createTheme, Theme } from "@mui/material";
+import { alpha, createTheme, Shadows, Theme } from "@mui/material";
import { appWindow } from "@tauri-apps/api/window";
import { atomThemeMode } from "@/services/states";
import { defaultTheme, defaultDarkTheme } from "@/pages/_theme";
@@ -59,6 +59,7 @@ export const useCustomTheme = () => {
paper: dt.background_color,
},
},
+ shadows: Array(25).fill("none") as Shadows,
typography: {
// todo
fontFamily: setting.font_family
@@ -87,11 +88,14 @@ export const useCustomTheme = () => {
}
// css
- const backgroundColor = mode === "light" ? "#ffffff" : "#0B121C";
+ const backgroundColor = mode === "light" ? "#f0f0f0" : "#2e303d";
const selectColor = mode === "light" ? "#f5f5f5" : "#d5d5d5";
const scrollColor = mode === "light" ? "#90939980" : "#54545480";
+ const dividerColor =
+ mode === "light" ? "rgba(0, 0, 0, 0.06)" : "rgba(255, 255, 255, 0.06)";
const rootEle = document.documentElement;
+ rootEle.style.setProperty("--divider-color", dividerColor);
rootEle.style.setProperty("--background-color", backgroundColor);
rootEle.style.setProperty("--selection-color", selectColor);
rootEle.style.setProperty("--scroller-color", scrollColor);
diff --git a/src/components/profile/profile-box.tsx b/src/components/profile/profile-box.tsx
index 6e15a879..97736636 100644
--- a/src/components/profile/profile-box.tsx
+++ b/src/components/profile/profile-box.tsx
@@ -2,41 +2,43 @@ import { alpha, Box, styled } from "@mui/material";
export const ProfileBox = styled(Box)(
({ theme, "aria-selected": selected }) => {
- const { mode, primary, text, grey, background } = theme.palette;
+ const { mode, primary, text } = theme.palette;
const key = `${mode}-${!!selected}`;
- const backgroundColor = {
- "light-true": alpha(primary.main, 0.2),
- "light-false": alpha(background.paper, 0.75),
- "dark-true": alpha(primary.main, 0.45),
- "dark-false": alpha(grey[700], 0.45),
- }[key]!;
+ const backgroundColor = mode === "light" ? "#ffffff" : "#282A36";
const color = {
"light-true": text.secondary,
"light-false": text.secondary,
- "dark-true": alpha(text.secondary, 0.85),
+ "dark-true": alpha(text.secondary, 0.65),
"dark-false": alpha(text.secondary, 0.65),
}[key]!;
const h2color = {
"light-true": primary.main,
"light-false": text.primary,
- "dark-true": primary.light,
+ "dark-true": primary.main,
"dark-false": text.primary,
}[key]!;
+ const borderLeft = {
+ "light-true": `3px solid ${primary.main}`,
+ "light-false": "none",
+ "dark-true": `3px solid ${primary.main}`,
+ "dark-false": "none",
+ }[key];
+
return {
position: "relative",
width: "100%",
display: "block",
cursor: "pointer",
textAlign: "left",
- borderRadius: theme.shape.borderRadius,
- boxShadow: theme.shadows[2],
padding: "8px 16px",
boxSizing: "border-box",
backgroundColor,
+ borderLeft,
+ borderRadius: "8px",
color,
"& h2": { color: h2color },
};
diff --git a/src/components/profile/profile-item.tsx b/src/components/profile/profile-item.tsx
index 5554717e..c619e8da 100644
--- a/src/components/profile/profile-item.tsx
+++ b/src/components/profile/profile-item.tsx
@@ -230,7 +230,14 @@ export const ProfileItem = (props: Props) => {
{...attributes}
{...listeners}
>
-
+ {
+ return { color: text.primary };
+ },
+ ]}
+ />
{
{parseExpire(updated)}
)}
-
+