Spaces:
Runtime error
Runtime error
Download src/components/button-scroll-to-bottom.tsx from Dragoning/bingo-going: direct link, hf CLI and curl.
- Browser
- Download file 891 Bytes
-
https://huggingface.co/spaces/Dragoning/bingo-going/resolve/main/src/components/button-scroll-to-bottom.tsx
- Command line
-
hf download hf://spaces/Dragoning/bingo-going/src/components/button-scroll-to-bottom.tsx
-
curl -L -o button-scroll-to-bottom.tsx https://huggingface.co/spaces/Dragoning/bingo-going/resolve/main/src/components/button-scroll-to-bottom.tsx
891 Bytes
| 'use client' | |
| import * as React from 'react' | |
| import { cn } from '@/lib/utils' | |
| import { useAtBottom } from '@/lib/hooks/use-at-bottom' | |
| import { Button, type ButtonProps } from '@/components/ui/button' | |
| import { IconArrowDown } from '@/components/ui/icons' | |
| export function ButtonScrollToBottom({ className, ...props }: ButtonProps) { | |
| const isAtBottom = useAtBottom() | |
| return ( | |
| <Button | |
| variant="outline" | |
| size="icon" | |
| className={cn( | |
| 'fixed right-4 bottom-24 z-50 bg-background transition-opacity duration-300 sm:right-20', | |
| isAtBottom ? 'opacity-0' : 'opacity-100', | |
| className | |
| )} | |
| onClick={() => | |
| window.scrollTo({ | |
| top: document.body.offsetHeight, | |
| behavior: 'smooth' | |
| }) | |
| } | |
| {...props} | |
| > | |
| <IconArrowDown /> | |
| <span className="sr-only">Scroll to bottom</span> | |
| </Button> | |
| ) | |
| } | |