Skip to content

Commit f22dfd4

Browse files
fix: blur circle uses library defaults, animation originates from correct button
- Match library default specs: duration 750ms, blurAmount 2, ease-in-out - Move toggleRef to mobile header button so animation originates from the visible button on mobile (was attached to hidden sidebar button)
1 parent 0303b22 commit f22dfd4

3 files changed

Lines changed: 6 additions & 6 deletions

File tree

client/src/components/Layout/Layout.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ interface LayoutProps {
1515
export default function Layout({ children }: LayoutProps) {
1616
const [mobileMenuOpen, setMobileMenuOpen] = useState(false);
1717
const location = useLocation();
18-
const { resolvedTheme, toggleTheme } = useTheme();
18+
const { resolvedTheme, toggleTheme, toggleRef } = useTheme();
1919

2020
// Swipe state refs (avoid re-renders during drag)
2121
const isDragging = useRef(false);
@@ -233,6 +233,7 @@ export default function Layout({ children }: LayoutProps) {
233233
<span className="text-lg font-display font-bold text-surface-50">Prunerr</span>
234234
</div>
235235
<button
236+
ref={toggleRef}
236237
onClick={toggleTheme}
237238
className="ml-auto p-2 rounded-xl text-surface-400 hover:text-accent-text-hover hover:bg-surface-800/60 transition-colors"
238239
aria-label={resolvedTheme === 'dark' ? 'Switch to light mode' : 'Switch to dark mode'}

client/src/components/Layout/Sidebar.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ const Sidebar = forwardRef<HTMLDivElement, SidebarProps>(function Sidebar({ onCl
4646
const { data: unraidStats } = useUnraidStats();
4747
const { data: queueItems } = useDeletionQueue();
4848
const { data: version } = useVersion();
49-
const { resolvedTheme, toggleTheme, toggleRef } = useTheme();
49+
const { resolvedTheme, toggleTheme } = useTheme();
5050
const queueCount = queueItems?.length ?? 0;
5151

5252
// Calculate storage display values
@@ -219,7 +219,6 @@ const Sidebar = forwardRef<HTMLDivElement, SidebarProps>(function Sidebar({ onCl
219219
<div className="px-6 py-3 border-t border-surface-800/50">
220220
<div className="flex items-center justify-center gap-3 mb-2">
221221
<button
222-
ref={toggleRef}
223222
onClick={toggleTheme}
224223
className="p-2.5 rounded-lg text-surface-500 hover:text-accent-text-hover hover:bg-surface-800/60 transition-all"
225224
title={resolvedTheme === 'dark' ? 'Switch to light mode' : 'Switch to dark mode'}

client/src/contexts/ThemeContext.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@ export function ThemeProvider({ children }: { children: ReactNode }) {
4848
const { ref, toggleSwitchTheme, isDarkMode } = useModeAnimation({
4949
isDarkMode: resolvedTheme === 'dark',
5050
animationType: ThemeAnimationType.BLUR_CIRCLE,
51-
duration: 600,
52-
blurAmount: 6,
53-
easing: 'cubic-bezier(0.4, 0, 0.2, 1)',
51+
duration: 750,
52+
blurAmount: 2,
53+
easing: 'ease-in-out',
5454
globalClassName: 'dark',
5555
onDarkModeChange: (isDark: boolean) => {
5656
setThemeState(isDark ? 'dark' : 'light');

0 commit comments

Comments
 (0)