You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
1020 B
TypeScript
39 lines
1020 B
TypeScript
import React, { useContext } from 'react';
|
|
import { useSelector } from 'react-redux';
|
|
import styled, { ThemeContext } from 'styled-components';
|
|
import { getShowScrollButton } from '../../state/selectors/conversations';
|
|
|
|
import { SessionIconButton, SessionIconSize, SessionIconType } from './icon';
|
|
|
|
type Props = {
|
|
onClick?: () => any;
|
|
};
|
|
|
|
const SessionScrollButtonDiv = styled.div`
|
|
position: fixed;
|
|
z-index: 2;
|
|
right: 60px;
|
|
animation: fadein ${props => props.theme.common.animations.defaultDuration};
|
|
`;
|
|
|
|
export const SessionScrollButton = (props: Props) => {
|
|
const themeContext = useContext(ThemeContext);
|
|
|
|
const show = useSelector(getShowScrollButton);
|
|
|
|
return (
|
|
<>
|
|
{show && (
|
|
<SessionScrollButtonDiv theme={themeContext}>
|
|
<SessionIconButton
|
|
iconType={SessionIconType.Chevron}
|
|
iconSize={SessionIconSize.Huge}
|
|
onClick={props.onClick}
|
|
theme={themeContext}
|
|
/>
|
|
</SessionScrollButtonDiv>
|
|
)}
|
|
</>
|
|
);
|
|
};
|