File size: 854 Bytes
052672d
 
8e3dbd3
052672d
 
c69ef3e
 
052672d
8e3dbd3
 
 
 
052672d
8e3dbd3
 
 
 
 
 
f80b091
 
 
 
 
8e3dbd3
f80b091
 
 
8e3dbd3
f80b091
 
 
 
 
 
052672d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
'use client';

import React from 'react';

import { cn } from '@/lib/utils';
import { Button, type ButtonProps } from '@/components/ui/Button';
import { IconArrowDown } from '@/components/ui/Icons';

interface ButtonScrollToBottomProps extends ButtonProps {
  isAtBottom: boolean;
  scrollToBottom: () => void;
}

export function ButtonScrollToBottom({
  className,
  isAtBottom,
  scrollToBottom,
  ...props
}: ButtonScrollToBottomProps) {
  return (
    <Button
      variant="outline"
      size="icon"
      className={cn(
        'fixed bottom-16 right-4 z-10 bg-background transition-opacity duration-300',
        isAtBottom ? 'opacity-0' : 'opacity-100',
        className,
      )}
      onClick={() => scrollToBottom()}
      {...props}
    >
      <IconArrowDown />
      <span className="sr-only">Scroll to bottom</span>
    </Button>
  );
}