Skip to content

Instantly share code, notes, and snippets.

@DonHuskini
Created April 4, 2021 22:37
Show Gist options
  • Save DonHuskini/ee1bd002d7daf4aad4a960b122c479dc to your computer and use it in GitHub Desktop.
Save DonHuskini/ee1bd002d7daf4aad4a960b122c479dc to your computer and use it in GitHub Desktop.
import styled from "styled-components";
import LeftArrow from "../icons/LeftArrow";
import RightArrow from "../icons/RightArrow";
export const S = {};
S.ArrowButton = styled.button`
background-color: transparent;
border: none;
position: absolute;
z-index: 999;
cursor: pointer;
${({ type }) =>
type === "prev"
? `left: 0;
right: auto;`
: `left: auto;
right: 0;`}
top: 50%;
transform: translateY(-50%);
visibility: ${({ isVisible }) => (isVisible ? "visible" : "hidden")};
opacity: 0;
&:focus {
outline: none;
}
&:hover {
background-color: rgba(0, 0, 0, 0.01);
}
`;
const ArrowButton = ({ type, isVisible, onClick }) => {
return (
<S.ArrowButton type={type} isVisible={isVisible} onClick={onClick}>
{type === "prev" ? <LeftArrow /> : <RightArrow />}
</S.ArrowButton>
);
};
export default ArrowButton;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment