ente/src/components/NavigationButton.tsx

56 lines
1.4 KiB
TypeScript
Raw Normal View History

2021-05-29 06:27:52 +00:00
import React from 'react';
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;')}
& > svg {
2021-05-29 06:27:52 +00:00
${(props) => props.direction === SCROLL_DIRECTION.LEFT && 'transform:rotate(180deg);'}
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%);
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-30 16:56:48 +00:00
const NavigationButton = ({ scrollDirection, ...rest }) => (
2021-05-29 06:27:52 +00:00
<Wrapper
direction={scrollDirection}
{...rest}
>
<NavigateNext />
</Wrapper>
);
export default NavigationButton;