Compare commits
No commits in common. '4d3825dbeefe3a214f09eed5d65e24da47c24fe5' and '5baffd02ca8fefea10624fa65d834dc80103a9c0' have entirely different histories.
4d3825dbee
...
5baffd02ca
@ -1,74 +1,25 @@ |
|||||||
/* import Link from "next/link"; */ |
import Link from "next/link"; |
||||||
import * as React from "react"; |
import * as React from "react"; |
||||||
import { SVGProps } from "react"; |
import { SVGProps } from "react"; |
||||||
import styled from "styled-components"; |
|
||||||
|
|
||||||
const ScrollMeWrapper = styled.div` |
const ScrollMe = (props: SVGProps<SVGSVGElement> & { href: string }) => ( |
||||||
position: absolute; |
<Link href={props.href}> |
||||||
bottom: 6rem; |
<svg |
||||||
left: 50%; |
xmlns="http://www.w3.org/2000/svg" |
||||||
color: var(--fg-faded); |
height="1em" |
||||||
animation-name: scrollMeAnim; |
viewBox="0 0 38 23" |
||||||
animation-duration: 3s; |
stroke="currentColor" |
||||||
animation-iteration-count: infinite; |
fill="none" |
||||||
|
{...props} |
||||||
@media only screen and (max-height: 490px) { |
> |
||||||
display: none; |
<path |
||||||
} |
strokeLinecap="round" |
||||||
|
strokeLinejoin="round" |
||||||
:hover { |
strokeWidth={2.8} |
||||||
cursor: pointer; |
d="m2 2 15.77 17.369a2 2 0 0 0 2.96 0L36.5 2" |
||||||
} |
/> |
||||||
|
</svg> |
||||||
svg { |
</Link> |
||||||
width: 1.2rem; |
); |
||||||
height: auto; |
|
||||||
} |
|
||||||
|
|
||||||
@keyframes scrollMeAnim { |
|
||||||
0% { |
|
||||||
opacity: 0; |
|
||||||
transform: translateY(0); |
|
||||||
} |
|
||||||
|
|
||||||
50% { |
|
||||||
opacity: 1; |
|
||||||
} |
|
||||||
|
|
||||||
100% { |
|
||||||
opacity: 0; |
|
||||||
transform: translateY(.75rem); |
|
||||||
} |
|
||||||
} |
|
||||||
`;
|
|
||||||
|
|
||||||
const ScrollMe = (props: SVGProps<SVGSVGElement> & { href: string }) => { |
|
||||||
const handleScroll = () => { |
|
||||||
const sectionRef = document.querySelector(props.href); |
|
||||||
if (sectionRef) { |
|
||||||
sectionRef.scrollIntoView({ behavior: "smooth" }); |
|
||||||
} |
|
||||||
}; |
|
||||||
|
|
||||||
return ( |
|
||||||
<ScrollMeWrapper onClick={handleScroll}> |
|
||||||
<svg |
|
||||||
xmlns="http://www.w3.org/2000/svg" |
|
||||||
height="1em" |
|
||||||
viewBox="0 0 38 23" |
|
||||||
stroke="currentColor" |
|
||||||
fill="none" |
|
||||||
{...props} |
|
||||||
> |
|
||||||
<path |
|
||||||
strokeLinecap="round" |
|
||||||
strokeLinejoin="round" |
|
||||||
strokeWidth={2.8} |
|
||||||
d="m2 2 15.77 17.369a2 2 0 0 0 2.96 0L36.5 2" |
|
||||||
/> |
|
||||||
</svg> |
|
||||||
</ScrollMeWrapper> |
|
||||||
); |
|
||||||
}; |
|
||||||
|
|
||||||
export default ScrollMe; |
export default ScrollMe; |
||||||
|
Loading…
Reference in new issue