Skip to content

Commit a9e27e4

Browse files
committed
fix: remove header disable bg button on mobile
1 parent 561513e commit a9e27e4

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

src/App.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,7 @@ const App: React.FC = () => {
6262
i18n.changeLanguage(settingData?.data?.config?.language)
6363
}
6464

65-
const customMobileBackgroundImage =
66-
// @ts-expect-error CustomMobileBackgroundImage is a global variable
67-
(window.CustomMobileBackgroundImage as string) !== "" ? window.CustomMobileBackgroundImage : undefined
65+
const customMobileBackgroundImage = window.CustomMobileBackgroundImage !== "" ? window.CustomMobileBackgroundImage : undefined
6866

6967
return (
7068
<Router basename={import.meta.env.BASE_URL}>

src/components/Header.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ function Header() {
4141
// @ts-expect-error CustomDesc is a global variable
4242
const customDesc = window.CustomDesc || t("nezha")
4343

44+
const customMobileBackgroundImage = window.CustomMobileBackgroundImage !== "" ? window.CustomMobileBackgroundImage : undefined
45+
4446
useEffect(() => {
4547
const link = document.querySelector("link[rel*='icon']") || document.createElement("link")
4648
// @ts-expect-error set link.type
@@ -109,6 +111,7 @@ function Header() {
109111
onClick={handleBackgroundToggle}
110112
className={cn("rounded-full px-[9px] bg-white dark:bg-black", {
111113
"bg-white/70 dark:bg-black/70": customBackgroundImage,
114+
"hidden sm:block": customMobileBackgroundImage,
112115
})}
113116
>
114117
<ImageMinus className="w-4 h-4" />

src/hooks/use-background.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { useEffect, useState } from "react"
33
declare global {
44
interface Window {
55
CustomBackgroundImage: string
6+
CustomMobileBackgroundImage: string
67
}
78
}
89

0 commit comments

Comments
 (0)