2021-08-31 05:58:34 +02:00
|
|
|
import React from 'react';
|
2021-07-20 08:58:51 +02:00
|
|
|
import { useSelector } from 'react-redux';
|
2021-08-31 05:58:34 +02:00
|
|
|
import styled from 'styled-components';
|
2021-12-14 05:15:12 +01:00
|
|
|
import { getShowScrollButton } from '../state/selectors/conversations';
|
2020-01-24 05:24:27 +01:00
|
|
|
|
2021-08-30 09:57:31 +02:00
|
|
|
import { SessionIconButton } from './icon';
|
2023-08-02 10:19:33 +02:00
|
|
|
import { Noop } from '../types/Util';
|
2020-01-24 05:24:27 +01:00
|
|
|
|
2020-10-29 04:53:27 +01:00
|
|
|
const SessionScrollButtonDiv = styled.div`
|
|
|
|
position: fixed;
|
|
|
|
z-index: 2;
|
|
|
|
right: 60px;
|
2021-08-31 05:58:34 +02:00
|
|
|
animation: fadein var(--default-duration);
|
2022-09-28 06:32:18 +02:00
|
|
|
|
|
|
|
.session-icon-button {
|
|
|
|
background-color: var(--message-bubbles-received-background-color);
|
2022-10-19 04:28:13 +02:00
|
|
|
box-shadow: var(--scroll-button-shadow);
|
2022-09-28 06:32:18 +02:00
|
|
|
}
|
2020-10-29 04:53:27 +01:00
|
|
|
`;
|
2020-01-24 05:24:27 +01:00
|
|
|
|
2023-08-02 10:19:33 +02:00
|
|
|
export const SessionScrollButton = (props: { onClickScrollBottom: Noop }) => {
|
2021-07-20 08:58:51 +02:00
|
|
|
const show = useSelector(getShowScrollButton);
|
|
|
|
|
2020-10-29 04:53:27 +01:00
|
|
|
return (
|
2021-08-31 05:58:34 +02:00
|
|
|
<SessionScrollButtonDiv>
|
2021-07-30 08:12:36 +02:00
|
|
|
<SessionIconButton
|
2021-08-30 09:57:31 +02:00
|
|
|
iconType="chevron"
|
2021-08-30 06:02:15 +02:00
|
|
|
iconSize={'huge'}
|
2021-07-30 08:12:36 +02:00
|
|
|
isHidden={!show}
|
2022-01-27 06:22:53 +01:00
|
|
|
onClick={props.onClickScrollBottom}
|
2022-05-17 05:22:13 +02:00
|
|
|
dataTestId="scroll-to-bottom-button"
|
2021-07-30 08:12:36 +02:00
|
|
|
/>
|
|
|
|
</SessionScrollButtonDiv>
|
2020-10-29 04:53:27 +01:00
|
|
|
);
|
|
|
|
};
|