fix: show ScrollToTopButton in two-column layout (#635)

This commit is contained in:
Cody Tseng 2025-10-30 17:32:06 +08:00 committed by GitHub
parent 63c9713ea8
commit b842d1eabf
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -2,7 +2,6 @@ import { Button } from '@/components/ui/button'
import { cn } from '@/lib/utils' import { cn } from '@/lib/utils'
import { useDeepBrowsing } from '@/providers/DeepBrowsingProvider' import { useDeepBrowsing } from '@/providers/DeepBrowsingProvider'
import { useScreenSize } from '@/providers/ScreenSizeProvider' import { useScreenSize } from '@/providers/ScreenSizeProvider'
import { useUserPreferences } from '@/providers/UserPreferencesProvider'
import { hasBackgroundAudioAtom } from '@/services/media-manager.service' import { hasBackgroundAudioAtom } from '@/services/media-manager.service'
import { useAtomValue } from 'jotai' import { useAtomValue } from 'jotai'
import { ChevronUp } from 'lucide-react' import { ChevronUp } from 'lucide-react'
@ -15,7 +14,6 @@ export default function ScrollToTopButton({
scrollAreaRef?: React.RefObject<HTMLDivElement> scrollAreaRef?: React.RefObject<HTMLDivElement>
className?: string className?: string
}) { }) {
const { enableSingleColumnLayout } = useUserPreferences()
const { deepBrowsing, lastScrollTop } = useDeepBrowsing() const { deepBrowsing, lastScrollTop } = useDeepBrowsing()
const { isSmallScreen } = useScreenSize() const { isSmallScreen } = useScreenSize()
const hasBackgroundAudio = useAtomValue(hasBackgroundAudioAtom) const hasBackgroundAudio = useAtomValue(hasBackgroundAudioAtom)
@ -54,8 +52,7 @@ export default function ScrollToTopButton({
return ( return (
<div <div
className={cn( className={cn(
'z-30 flex justify-end w-full pr-3 pointer-events-none transition-opacity duration-700', 'sticky z-30 flex justify-end w-full pr-3 pointer-events-none transition-opacity duration-700',
enableSingleColumnLayout ? 'sticky' : 'fixed',
visible ? '' : 'opacity-0', visible ? '' : 'opacity-0',
className className
)} )}