Add files via upload

This commit is contained in:
Sam 2023-05-26 13:32:31 +03:00 committed by GitHub
parent 10df54181c
commit e349b1958c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 100 additions and 0 deletions

View File

@ -0,0 +1,30 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta2/css/all.min.css" integrity="sha512-YWzhKL2whUzgiheMoBFwW8CKV4qpHQAEuvilg9FAn5VJUDwKZZxkJNuGM4XkWuk94WCrrwslk8yWNGmY1EduTA==" crossorigin="anonymous" referrerpolicy="no-referrer"/>
<link rel="stylesheet" href="style.css" />
</head>
<body>
<div class="feedback-container">
<div class="emoji-container">
<i class="far fa-angry fa-3x"></i>
<i class="far fa-frown fa-3x"></i>
<i class="far fa-meh fa-3x"></i>
<i class="far fa-smile fa-3x"></i>
<i class="far fa-laugh fa-3x"></i>
</div>
<div class="rating-container">
<i class="fas fa-star fa-2x active"></i>
<i class="fas fa-star fa-2x"></i>
<i class="fas fa-star fa-2x"></i>
<i class="fas fa-star fa-2x"></i>
<i class="fas fa-star fa-2x"></i>
</div>
</div>
<script src="main.js"></script>
</body>
</html>

View File

@ -0,0 +1,25 @@
const starsEl = document.querySelectorAll(".fa-star");
const emojisEl = document.querySelectorAll(".far");
const colorsArray = ["#f00000", "#F77820", "#8e9dc3", "#c1fa94", "#00a35e"];
updateRating(0);
starsEl.forEach((starEl, index) => {
starEl.addEventListener("click", () => {
updateRating(index);
});
});
function updateRating(index) {
starsEl.forEach((starEl, idx) => {
if (idx < index + 1) {
starEl.classList.add("active");
} else {
starEl.classList.remove("active");
}
});
emojisEl.forEach((emojiEl) => {
emojiEl.style.transform = `translateX(-${index * 50}px)`;
emojiEl.style.color = colorsArray[index];
});
}

View File

@ -0,0 +1,45 @@
body {
margin: 0;
display: flex;
justify-content: center;
height: 100vh;
align-items: center;
background-color:#FFD54F;
}
.feedback-container {
background-color: white;
width: 400px;
height: 250px;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.5);
border-radius: 10px;
position: relative;
}
.emoji-container {
position: absolute;
left: 50%;
transform: translateX(-50%);
top: 20%;
width: 50px;
height: 50px;
border-radius: 50%;
display: flex;
overflow: hidden;
}
.far {
margin: 1px;
transform: translateX(0);
transition: transform 0.2s;
}
.rating-container {
position: absolute;
left: 50%;
transform: translateX(-50%);
bottom: 20%;
}
.fa-star {
color: lightgray;
cursor: pointer;
}
.fa-star.active {
color: #FFD54F;
}