Skip to content

Commit

Permalink
Dynamic tooltip ui fix
Browse files Browse the repository at this point in the history
  • Loading branch information
sadanandpai committed Jul 15, 2024
1 parent 9628582 commit 936fbf2
Show file tree
Hide file tree
Showing 8 changed files with 96 additions and 101 deletions.
68 changes: 68 additions & 0 deletions apps/css/src/challenges/dynamic-tooltip/index.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
.avatar {
background-image: url(img.jpg);
width: min(40vh, 40vw);
height: min(40vh, 40vw);
border-radius: 50%;
background-size: cover;
background-position: center;
position: relative;
margin: 0 auto;
}

.avatar::before {
--scale: 0;
content: attr(data-tooltip);
color: white;
background-color: black;
position: absolute;
padding: 5px;
text-align: center;
transform: translate(-50%, -100%) scale(var(--scale));
transition: 80ms transform;
transform-origin: bottom center;
top: -0.6rem;
left: 50%;
}

.avatar::after {
--scale: 0;
content: '';
width: 0;
height: 0;
border: 10px solid transparent;
border-top-color: black;
position: absolute;
left: 50%;
transform: translate(-50%, -100%) scale(var(--scale));
transition: 80ms transform;
transform-origin: top center;
top: 0.59rem;
}

.avatar.left::before {
--scale: 0;
top: 50%;
left: -0.6rem;
transform: translate(-100%, 0%) scale(var(--scale));
transform-origin: left center;
}

.avatar.left::after {
--scale: 0;
top: 50%;
left: -0.8rem;
border: 10px solid transparent;
border-left-color: black;
transform: translate(0%, 30%) scale(var(--scale));
transition: 80ms transform;
transform-origin: right center;
}

.avatar:hover::before,
.avatar.left.hover::before {
--scale: 1;
}
.avatar:hover::after,
.avatar.left.hover::after {
--scale: 1;
}
13 changes: 13 additions & 0 deletions apps/css/src/challenges/dynamic-tooltip/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<script src="./../../helpers/header.js" type="module"></script>
<link rel="stylesheet" href="index.css" />
</head>
<body>
<div class="container">
<div class="avatar left" data-tooltip="Thinking Cat"></div>
</div>
</body>
</html>
75 changes: 0 additions & 75 deletions apps/javascript/src/challenges/dynamic-tooltip/index.css

This file was deleted.

15 changes: 0 additions & 15 deletions apps/javascript/src/challenges/dynamic-tooltip/index.html

This file was deleted.

4 changes: 4 additions & 0 deletions shared/data/content/contributors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -209,4 +209,8 @@ export const contributors = new Map<string, IContributor>([
'Akshat-Gupta',
{ name: 'Akshat Gupta', pic: 'https://avatars.githubusercontent.com/u/53713926' },
],
[
'officialbidisha',
{ name: 'Bidisha Das', pic: 'https://avatars.githubusercontent.com/u/49115207' },
],
]);
11 changes: 11 additions & 0 deletions shared/data/content/css-challenges.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,17 @@ const challenges: Map<string, IChallenge> = new Map([
tags: [],
},
],
[
'dynamic-tooltip',
{
title: 'Dynamic Tooltip',
link: 'dynamic-tooltip/',
difficulty: EDifficulty.Easy,
developer: 'officialbidisha',
tags: [],
isNew: true,
},
],
[
'light-dark-mode',
{
Expand Down
11 changes: 0 additions & 11 deletions shared/data/content/js-challenges.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,6 @@ const challenges: Map<string, IChallenge> = new Map([
isNew: true,
},
],
[
'dynamic-tooltip',
{
title: 'Dynamic Tooltip',
link: 'dynamic-tooltip/',
difficulty: EDifficulty.Easy,
developer: 'officialbidisha',
tags: [],
isNew: true,
}
],
[
'roll-dice',
{
Expand Down

0 comments on commit 936fbf2

Please sign in to comment.