mirror of https://github.com/buster-so/buster.git
Update ChatScrollToBottom.tsx
This commit is contained in:
parent
21b893d632
commit
55d2a1dc3c
|
@ -2,22 +2,25 @@ import { type useAutoScroll } from '@/hooks/useAutoScroll';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { ChevronDown } from '@/components/ui/icons';
|
import { ChevronDown } from '@/components/ui/icons';
|
||||||
import { cn } from '@/lib/utils';
|
import { cn } from '@/lib/utils';
|
||||||
|
import { AppTooltip } from '@/components/ui/tooltip';
|
||||||
|
|
||||||
export const ChatScrollToBottom: React.FC<{
|
export const ChatScrollToBottom: React.FC<{
|
||||||
isAutoScrollEnabled: boolean;
|
isAutoScrollEnabled: boolean;
|
||||||
scrollToBottom: ReturnType<typeof useAutoScroll>['scrollToBottom'];
|
scrollToBottom: ReturnType<typeof useAutoScroll>['scrollToBottom'];
|
||||||
}> = React.memo(({ isAutoScrollEnabled, scrollToBottom }) => {
|
}> = React.memo(({ isAutoScrollEnabled, scrollToBottom }) => {
|
||||||
return (
|
return (
|
||||||
<button
|
<AppTooltip title="Stick to bottom">
|
||||||
onClick={() => scrollToBottom('instant')}
|
<button
|
||||||
className={cn(
|
onClick={scrollToBottom}
|
||||||
'bg-background/90 hover:bg-item-hover/90 absolute -top-9 right-3 z-10 rounded-full border p-2 shadow transition-all duration-300 hover:scale-105 hover:shadow-md',
|
className={cn(
|
||||||
isAutoScrollEnabled
|
'bg-background/90 hover:bg-item-hover/90 absolute -top-9 right-3 z-10 rounded-full border p-2 shadow transition-all duration-300 hover:scale-105 hover:shadow-md',
|
||||||
? 'pointer-events-none scale-90 opacity-0'
|
isAutoScrollEnabled
|
||||||
: 'pointer-events-auto scale-100 cursor-pointer opacity-100'
|
? 'pointer-events-none scale-90 opacity-0'
|
||||||
)}>
|
: 'pointer-events-auto scale-100 cursor-pointer opacity-100'
|
||||||
<ChevronDown />
|
)}>
|
||||||
</button>
|
<ChevronDown />
|
||||||
|
</button>
|
||||||
|
</AppTooltip>
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue