feat: sticky list mode switcher

This commit is contained in:
codytseng
2025-01-24 16:53:01 +08:00
parent ee21e19625
commit 1df975dfc6
7 changed files with 175 additions and 183 deletions

View File

@@ -3,6 +3,7 @@ import { PICTURE_EVENT_KIND } from '@/constants'
import { isReplyNoteEvent } from '@/lib/event'
import { checkAlgoRelay } from '@/lib/relay'
import { cn } from '@/lib/utils'
import { useDeepBrowsing } from '@/providers/DeepBrowsingProvider'
import { useMuteList } from '@/providers/MuteListProvider'
import { useNostr } from '@/providers/NostrProvider'
import { useScreenSize } from '@/providers/ScreenSizeProvider'
@@ -236,9 +237,15 @@ function ListModeSwitch({
setListMode: (listMode: TNoteListMode) => void
}) {
const { t } = useTranslation()
const { deepBrowsing } = useDeepBrowsing()
return (
<div>
<div
className={cn(
'sticky top-12 bg-background z-10 duration-700 transition-transform',
deepBrowsing ? '-translate-y-[calc(100%+12rem)]' : ''
)}
>
<div className="flex">
<div
className={`w-1/3 text-center py-2 font-semibold clickable cursor-pointer rounded-lg ${listMode === 'posts' ? '' : 'text-muted-foreground'}`}