Skip to content

Commit

Permalink
fix(linux): replace backdrop blur to background opacity
Browse files Browse the repository at this point in the history
  • Loading branch information
keiko233 committed Aug 29, 2024
1 parent 29494e0 commit 692a458
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 9 deletions.
33 changes: 28 additions & 5 deletions frontend/nyanpasu/src/components/app/app-drawer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,20 @@ import { useState } from "react";
import { classNames } from "@/utils";
import getSystem from "@/utils/get-system";
import { MenuOpen } from "@mui/icons-material";
import { alpha, Backdrop, IconButton, useTheme } from "@mui/material";
import {
alpha,
Backdrop,
darken,
IconButton,
lighten,
useTheme,
} from "@mui/material";
import { cn } from "@nyanpasu/ui";
import AnimatedLogo from "../layout/animated-logo";
import DrawerContent from "./drawer-content";

const OS = getSystem();

export const AppDrawer = () => {
const { palette } = useTheme();

Expand All @@ -17,7 +27,7 @@ export const AppDrawer = () => {
<div
className={classNames(
"fixed z-10 flex items-center gap-2",
getSystem() === "macos" ? "left-24 top-3" : "left-4 top-1.5",
OS === "macos" ? "left-24 top-3" : "left-4 top-1.5",
)}
data-windrag
>
Expand Down Expand Up @@ -48,9 +58,12 @@ export const AppDrawer = () => {
<DrawerTitle />

<Backdrop
className="z-20 backdrop-blur-xl"
className={cn("z-20", OS !== "linux" && "backdrop-blur-xl")}
sx={{
backgroundColor: alpha(palette.primary[palette.mode], 0.1),
backgroundColor:
OS === "linux"
? undefined
: alpha(palette.primary[palette.mode], 0.1),
}}
open={open}
onClick={() => setOpen(false)}
Expand All @@ -72,7 +85,17 @@ export const AppDrawer = () => {
type: "tween",
}}
>
<DrawerContent className="max-w-64" />
<DrawerContent
className="max-w-64"
style={{
backgroundColor:
OS === "linux"
? palette.mode === "light"
? lighten(palette.primary[palette.mode], 0.9)
: darken(palette.primary[palette.mode], 0.7)
: undefined,
}}
/>
</motion.div>
</div>
</AnimatePresence>
Expand Down
11 changes: 9 additions & 2 deletions frontend/nyanpasu/src/components/app/drawer-content.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useSize } from "ahooks";
import clsx from "clsx";
import { useAtom } from "jotai";
import { useCallback, useEffect, useRef } from "react";
import { CSSProperties, useCallback, useEffect, useRef } from "react";
import { atomIsDrawerOnlyIcon } from "@/store";
import getSystem from "@/utils/get-system";
import { languageQuirks } from "@/utils/language";
Expand All @@ -10,7 +10,13 @@ import { useNyanpasu } from "@nyanpasu/interface";
import AnimatedLogo from "../layout/animated-logo";
import RouteListItem from "./modules/route-list-item";

export const DrawerContent = ({ className }: { className?: string }) => {
export const DrawerContent = ({
className,
style,
}: {
className?: string;
style?: CSSProperties;
}) => {
const [onlyIcon, setOnlyIcon] = useAtom(atomIsDrawerOnlyIcon);

const { nyanpasuConfig } = useNyanpasu();
Expand Down Expand Up @@ -58,6 +64,7 @@ export const DrawerContent = ({ className }: { className?: string }) => {
)}
style={{
backgroundColor: "var(--background-color-alpha)",
...style,
}}
data-windrag
>
Expand Down
10 changes: 8 additions & 2 deletions frontend/ui/src/materialYou/components/baseDialog/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,15 @@ export const BaseDialog = ({
<Portal.Root className="fixed left-0 top-0 z-50 h-dvh w-full">
{!full && (
<motion.div
className="absolute inset-0 z-50 backdrop-blur-xl"
className={cn(
"absolute inset-0 z-50",
OS === "linux" ? "bg-black/50" : "backdrop-blur-xl",
)}
style={{
backgroundColor: alpha(palette.primary[palette.mode], 0.1),
backgroundColor:
OS === "linux"
? undefined
: alpha(palette.primary[palette.mode], 0.1),
}}
animate={open ? "open" : "closed"}
initial={{ opacity: 0 }}
Expand Down

0 comments on commit 692a458

Please sign in to comment.