2021-05-29 06:27:52 +00:00
|
|
|
import React from 'react';
|
2021-05-23 04:28:11 +00:00
|
|
|
import styled from 'styled-components';
|
|
|
|
import NavigateNext from './NavigateNext';
|
|
|
|
|
|
|
|
export enum SCROLL_DIRECTION {
|
|
|
|
LEFT = -1,
|
|
|
|
RIGHT = +1,
|
|
|
|
}
|
|
|
|
|
|
|
|
const Wrapper = styled.button<{ direction: SCROLL_DIRECTION }>`
|
|
|
|
height: 40px;
|
|
|
|
width: 40px;
|
|
|
|
background-color: #191919;
|
|
|
|
border: none;
|
|
|
|
color: #eee;
|
|
|
|
z-index: 1;
|
|
|
|
position: absolute;
|
2021-05-29 06:27:52 +00:00
|
|
|
${(props) => (props.direction === SCROLL_DIRECTION.LEFT ? 'margin-right: 10px;' : 'margin-left: 10px;')}
|
|
|
|
${(props) => (props.direction === SCROLL_DIRECTION.LEFT ? 'left: 0;' : 'right: 0;')}
|
2021-05-23 04:28:11 +00:00
|
|
|
|
|
|
|
& > svg {
|
2021-05-29 06:27:52 +00:00
|
|
|
${(props) => props.direction === SCROLL_DIRECTION.LEFT && 'transform:rotate(180deg);'}
|
2021-05-23 04:28:11 +00:00
|
|
|
border-radius: 50%;
|
|
|
|
height: 30px;
|
|
|
|
width: 30px;
|
|
|
|
}
|
|
|
|
|
|
|
|
&:hover > svg {
|
|
|
|
background-color: #555;
|
|
|
|
}
|
|
|
|
|
|
|
|
&:hover {
|
|
|
|
color:#fff;
|
|
|
|
}
|
|
|
|
|
|
|
|
&::after {
|
|
|
|
content: ' ';
|
2021-05-29 06:27:52 +00:00
|
|
|
background: linear-gradient(to ${(props) => (props.direction === SCROLL_DIRECTION.LEFT ? 'right' : 'left')}, #191919 5%, rgba(255, 255, 255, 0) 80%);
|
2021-05-23 04:28:11 +00:00
|
|
|
position: absolute;
|
|
|
|
top: 0;
|
|
|
|
width: 40px;
|
|
|
|
height: 40px;
|
2021-05-29 06:27:52 +00:00
|
|
|
${(props) => (props.direction === SCROLL_DIRECTION.LEFT ? 'left: 40px;' : 'right: 40px;')}
|
2021-05-23 04:28:11 +00:00
|
|
|
}
|
|
|
|
`;
|
|
|
|
|
2021-05-30 16:56:48 +00:00
|
|
|
const NavigationButton = ({ scrollDirection, ...rest }) => (
|
2021-05-29 06:27:52 +00:00
|
|
|
<Wrapper
|
|
|
|
direction={scrollDirection}
|
|
|
|
{...rest}
|
|
|
|
>
|
|
|
|
<NavigateNext />
|
|
|
|
</Wrapper>
|
|
|
|
);
|
2021-05-23 04:28:11 +00:00
|
|
|
export default NavigationButton;
|