Social links widget

This commit is contained in:
Brad Traversy 2020-10-29 10:42:14 -04:00
parent 2a401d734d
commit 67c3d905b1
3 changed files with 148 additions and 0 deletions

39
social-links/index.html Normal file
View File

@ -0,0 +1,39 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.1/css/all.min.css" integrity="sha512-+4zCK9k+qNFUR5X+cKL9EIR+ZOhtIloNl9GIKS57V1MyNsYpYcUrUeQc9vNfzsWfV28IaLL3i96P9sdNyeRssA==" crossorigin="anonymous" />
<link rel="stylesheet" href="style.css" />
<title>Social Links</title>
</head>
<body>
<div class="container a b c" id="container">
<button id="open" class="open-btn">
<i class="fas fa-share-alt"></i>
</button>
<a href="https://youtube.com" class="ytb" target="_blank">
<i class="fab fa-youtube"></i>
</a>
<a href="https://twitter.com" class="twt" target="_blank">
<i class="fab fa-twitter"></i>
</a>
<a href="#" class="x" id="close">
<i class="fas fa-times"></i>
</a>
<a href="https://linkedin.com" class="lin" target="_blank">
<i class="fab fa-linkedin"></i>
</a>
<a href="https://instagram.com" class="ins" target="_blank">
<i class="fab fa-instagram"></i>
</a>
</div>
<script src="script.js"></script>
</body>
</html>

7
social-links/script.js Normal file
View File

@ -0,0 +1,7 @@
const container = document.getElementById('container')
const open = document.getElementById('open')
const close = document.getElementById('close')
open.addEventListener('click', () => container.classList.add('open'))
close.addEventListener('click', () => container.classList.remove('open'))

102
social-links/style.css Normal file
View File

@ -0,0 +1,102 @@
@import url('https://fonts.googleapis.com/css?family=Muli&display=swap');
* {
box-sizing: border-box;
}
body {
background-color: #e0e0e0;
display: flex;
align-items: center;
justify-content: center;
height: 100vh;
margin: 0;
}
.container {
background-color: #fff;
border-radius: 50px;
overflow: hidden;
display: flex;
align-items: center;
justify-content: center;
position: relative;
transition: 0.4s ease;
height: 70px;
width: 70px;
}
.container.open {
width: 350px;
}
.container .open-btn {
position: absolute;
top: 0;
left: 0;
background-image: linear-gradient(
110.1deg,
rgba(241, 115, 30, 1) 18.9%,
rgba(231, 29, 54, 1) 90.7%
);
color: #fff;
cursor: pointer;
border: 0;
border-radius: 50%;
font-size: 26px;
display: flex;
align-items: center;
justify-content: center;
padding: 0;
height: 70px;
width: 70px;
z-index: 100;
}
.container.open .open-btn {
display: none;
}
.container a {
background-color: #fff;
border-radius: 50%;
font-size: 26px;
display: flex;
align-items: center;
justify-content: center;
position: absolute;
top: 0;
left: 0;
margin: 10px;
height: 50px;
width: 50px;
text-decoration: none;
opacity: 0;
}
.container.open a {
position: static;
opacity: 1;
transition: 0.4s ease;
}
.container a.ytb {
background-color: #ff0000;
}
.container a.twt {
background-color: #1da1f2;
}
.container a.x {
background-color: #282c37;
}
.container a.lin {
background-color: #007bb5;
}
.container a.ins {
background-color: #c32aa3;
}
.container a i {
color: #fff;
}