Skip to content

Commit 542b1e8

Browse files
Added an animated scroll down button on header section
1 parent 3ac4655 commit 542b1e8

File tree

3 files changed

+50
-13
lines changed

3 files changed

+50
-13
lines changed

src/components/LinkButton/LinkButton.css

Lines changed: 35 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@
77

88
border-width: 0;
99
border-radius: 2px;
10-
box-shadow: 0 1px 4px rgba(0, 0, 0, .2);
11-
10+
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
11+
1212
background-color: #2ecc71;
1313
color: #fff;
14-
15-
-webkit-transition: background-color .3s;
16-
-moz-transition: background-color .3s;
17-
transition: background-color .3s;
18-
margin-bottom: 10vw;
14+
15+
-webkit-transition: background-color 0.3s;
16+
-moz-transition: background-color 0.3s;
17+
transition: background-color 0.3s;
18+
margin-bottom: 0 !important;
1919
}
2020

2121
.LinkButton:hover {
@@ -24,5 +24,32 @@
2424

2525
.LinkButton > span {
2626
font-size: 1.1em;
27-
letter-spacing: .05em;
27+
letter-spacing: 0.05em;
28+
}
29+
.LinkButton-Wrapper {
30+
display: flex;
31+
align-items: center;
32+
justify-content: center;
33+
flex-direction: column;
34+
margin-bottom: 2rem;
35+
}
36+
.Scroll-Down {
37+
cursor: pointer;
38+
position: relative;
39+
animation: swing alternate 0.5s infinite;
40+
}
41+
.Scroll-Down:active {
42+
opacity: 0.75;
43+
}
44+
.Scroll-Down-Wrapper {
45+
padding: 1vw;
46+
padding-bottom: 1.75vw;
47+
}
48+
@keyframes swing {
49+
from {
50+
top: -0.5rem;
51+
}
52+
to {
53+
top: 1rem;
54+
}
2855
}

src/components/LinkButton/LinkButton.jsx

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,21 @@
1-
import React, { Component } from 'react';
2-
import './LinkButton.css';
1+
import React, { Component } from "react";
2+
import "./LinkButton.css";
3+
import scrollDown from "./scroll-down.svg";
34

45
class LinkButton extends Component {
56
render() {
67
return (
7-
<a className="LinkButton" href="https://github.com/firstcontributions/first-contributions/blob/master/README.md">
8-
<span> Get started </span>
9-
</a>
8+
<div className="LinkButton-Wrapper">
9+
<a
10+
className="LinkButton"
11+
href="https://github.com/firstcontributions/first-contributions/blob/master/README.md"
12+
>
13+
<span> Get started </span>
14+
</a>
15+
<div className="Scroll-Down-Wrapper">
16+
<img className="Scroll-Down" onClick={() => { window.scrollBy({ top: window.innerHeight - 80, left: 0, behavior: "smooth" }); }} src={scrollDown} alt="Scroll Down!" width="64" height="64" />
17+
</div>
18+
</div>
1019
);
1120
}
1221
}
Lines changed: 1 addition & 0 deletions
Loading

0 commit comments

Comments
 (0)