move a part of SessionSrollButton to styled component
parent
857bea50ea
commit
e0fd910fa4
@ -1,31 +1,34 @@
|
|||||||
import React from 'react';
|
import React, { useContext } from 'react';
|
||||||
|
import styled, { ThemeContext } from 'styled-components';
|
||||||
|
|
||||||
import { SessionIconButton, SessionIconSize, SessionIconType } from './icon';
|
import { SessionIconButton, SessionIconSize, SessionIconType } from './icon';
|
||||||
|
|
||||||
interface Props {
|
type Props = {
|
||||||
onClick?: () => any;
|
onClick?: () => any;
|
||||||
show?: boolean;
|
show?: boolean;
|
||||||
}
|
};
|
||||||
|
|
||||||
export class SessionScrollButton extends React.PureComponent<Props> {
|
const SessionScrollButtonDiv = styled.div`
|
||||||
constructor(props: any) {
|
position: fixed;
|
||||||
super(props);
|
z-index: 2;
|
||||||
}
|
right: 60px;
|
||||||
|
animation: fadein ${props => props.theme.common.animations.defaultDuration};
|
||||||
|
`;
|
||||||
|
|
||||||
public render() {
|
export const SessionScrollButton = (props: Props) => {
|
||||||
return (
|
const themeContext = useContext(ThemeContext);
|
||||||
<>
|
|
||||||
{this.props.show && (
|
return (
|
||||||
<div className="session-scroll-button">
|
<>
|
||||||
<SessionIconButton
|
{props.show && (
|
||||||
iconType={SessionIconType.Chevron}
|
<SessionScrollButtonDiv theme={themeContext}>
|
||||||
iconSize={SessionIconSize.Huge}
|
<SessionIconButton
|
||||||
iconColor={'#FFFFFF'}
|
iconType={SessionIconType.Chevron}
|
||||||
onClick={this.props.onClick}
|
iconSize={SessionIconSize.Huge}
|
||||||
/>
|
onClick={props.onClick}
|
||||||
</div>
|
/>
|
||||||
)}
|
</SessionScrollButtonDiv>
|
||||||
</>
|
)}
|
||||||
);
|
</>
|
||||||
}
|
);
|
||||||
}
|
};
|
||||||
|
Loading…
Reference in New Issue