Skip to content

Commit

Permalink
Added Tooltips on hover. Added action btn color change on hover.
Browse files Browse the repository at this point in the history
  • Loading branch information
AdityaBavadekar committed Oct 12, 2024
1 parent 387909f commit 4030a4d
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 15 deletions.
21 changes: 11 additions & 10 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -45,17 +45,18 @@
/>
</svg>
</div>
<a href="./index.html" class="text-gray-300 hover:text-green-500"
<a href="./index.html" class="text-gray-300 hover:text-green-500 my-auto"
>Home</a
>

<a href="./index.html" class="text-gray-300 hover:text-green-500"
<a href="./index.html" class="text-gray-300 hover:text-green-500 my-auto"
>Previous</a
>
<a href="./pbd.html" class="text-gray-300 hover:text-green-500"
<a href="./pbd.html" class="text-gray-300 hover:text-green-500 my-auto"
>Next</a
>
<button id="theme-toggle" class="text-gray-300 hover:text-green-500">
<button id="theme-toggle" class="text-gray-300 rounded tooltip-parent my-auto tooltip-left">
<span class="tooltip">Switch theme</span>
<svg
xmlns="http://www.w3.org/2000/svg"
class="h-6 w-6"
Expand Down Expand Up @@ -123,10 +124,10 @@ <h3 class="text-lg mt-2">By Richard Dawkins</h3>
</div>

<!-- Favorite Button -->
<div class="mt-4 flex justify-center favorite-button-container">
<i class="bi bi-heart mx-4 favorite-button"></i>
<i class="bi bi-share mx-4 favorite-button"></i>
<i class="bi bi-chat mx-4 favorite-button"></i>
<div class="mt-4 flex justify-center icon-action-btn-container">
<i class="bi bi-heart mx-4 icon-action-btn tooltip-parent tooltip-bottom" id="favourite-btn"><span class="tooltip">Save to Favourites</span></i>
<i class="bi bi-share mx-4 icon-action-btn tooltip-parent tooltip-bottom" id="share-btn"><span class="tooltip">Share</span></i>
<i class="bi bi-chat mx-4 icon-action-btn tooltip-parent tooltip-bottom" id="view-comments-btn"><span class="tooltip">View comments</span></i>
</div>
</div>
<!-- playlist -->
Expand Down Expand Up @@ -181,7 +182,7 @@ <h2 class="text-center text-2xl mb-6">Share Your Thoughts</h2>
<input
type="text"
id="username"
class="w-full p-2 rounded-lg bg-gray-700 text-white"
class="w-full p-2 rounded-lg bg-gray-700 text-white mt-2"
required
/>
</div>
Expand All @@ -191,7 +192,7 @@ <h2 class="text-center text-2xl mb-6">Share Your Thoughts</h2>
>
<textarea
id="comment"
class="w-full p-2 rounded-lg bg-gray-700 text-white"
class="w-full p-2 rounded-lg bg-gray-700 text-white mt-2"
rows="4"
required
></textarea>
Expand Down
64 changes: 59 additions & 5 deletions style.css
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ button {
}

button:hover {
background-color: #1ed760;
background-color: hsl(141, 76%, 20%);
}

footer {
Expand Down Expand Up @@ -84,19 +84,19 @@ body.light-theme .playlist-card {
max-height: 50vh;
}

.favorite-button-container {
.icon-action-btn-container {
margin-top: 30px;
}

.favorite-button {
.icon-action-btn {
transition: color 0.3s;
}

.favorite-button.active {
.icon-action-btn.active {
color: #1db954;
}

.favorite-button:hover {
.icon-action-btn:hover {
color: #1db954;
}

Expand Down Expand Up @@ -152,3 +152,57 @@ body.light-theme .playlist-card {
.play-pause-button:hover {
background-color: #1ed760;
}

.tooltip-parent {
position: relative;
display: inline-block;
}

.tooltip {
margin: 28px;
border-radius: 8px;
visibility: hidden;
opacity: 0;
min-width: 150px;
background-color: rgba(0, 0, 0, 0.3);
position: absolute;
padding: 8px;
color: white;
z-index: 1;
transition: opactiy 0.24s;
text-decoration: none;
font-style: normal;
}

.tooltip-parent:hover .tooltip {
visibility: visible;
opacity: 1;
}

.tooltip-left .tooltip {
top: 50%;
right: 100%;
margin-right: 5px;
transform: translateY(-50%);
}

.tooltip-right .tooltip {
top: 50%;
left: 100%;
margin-left: 5px;
transform: translateY(-50%);
}

.tooltip-bottom .tooltip {
top: 100%;
left: 50%;
margin-left: -60px;
margin-top: 5px;
}

.tooltip-top .tooltip {
bottom: 100%;
left: 50%;
margin-left: -60px;
margin-bottom: 5px;
}

0 comments on commit 4030a4d

Please sign in to comment.