From fef6a46cb702e05fcd2ffca59749c5453c3c5353 Mon Sep 17 00:00:00 2001 From: molvqingtai Date: Wed, 6 Dec 2023 01:43:26 +0800 Subject: [PATCH] chore: theme button animation --- src/app/content/views/AppButton/index.tsx | 23 ++++++++++++++--------- wxt.config.ts | 7 ++++++- 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/src/app/content/views/AppButton/index.tsx b/src/app/content/views/AppButton/index.tsx index 9d30548..ad6394e 100644 --- a/src/app/content/views/AppButton/index.tsx +++ b/src/app/content/views/AppButton/index.tsx @@ -7,6 +7,7 @@ import { Button } from '@/components/ui/Button' import { EVENTS } from '@/constants' import UserInfoDomain from '@/domain/UserInfo' import useClickAway from '@/hooks/useClickAway' +import { checkSystemDarkMode, cn } from '@/utils' export interface AppButtonProps { children?: ReactNode @@ -18,11 +19,7 @@ const AppButton: FC = ({ children }) => { const userInfo = useRemeshQuery(userInfoDomain.query.UserInfoQuery()) const isDarkMode = - userInfo?.themeMode === 'dark' - ? true - : userInfo?.themeMode === 'light' - ? false - : window.matchMedia('(prefers-color-scheme: dark)').matches + userInfo?.themeMode === 'dark' ? true : userInfo?.themeMode === 'light' ? false : checkSystemDarkMode() const [open, setOpen] = useState(false) @@ -65,16 +62,24 @@ const AppButton: FC = ({ children }) => { onClick={handleSwitchTheme} variant="outline" data-state={open ? 'open' : 'closed'} - className="pointer-events-auto h-10 w-10 rounded-full p-0 shadow fill-mode-forwards data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out data-[state=open]:fade-in data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom" + className="pointer-events-auto relative h-10 w-10 overflow-hidden rounded-full p-0 shadow fill-mode-forwards data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out data-[state=open]:fade-in data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom" > - - {/* */} +
+ + +
diff --git a/wxt.config.ts b/wxt.config.ts index 0ac0137..6fb2814 100644 --- a/wxt.config.ts +++ b/wxt.config.ts @@ -13,7 +13,12 @@ export default defineConfig({ startUrls: ['https://www.example.com/'] }, manifest: { - permissions: ['storage'] + permissions: ['storage'], + browser_specific_settings: { + gecko: { + id: 'molvqingtai@gmail.com' + } + } }, vite: () => ({ define: {