Skip to content

Commit 5b2d723

Browse files
committed
fix tooltip animation
1 parent 9c4877e commit 5b2d723

File tree

6 files changed

+50
-22
lines changed

6 files changed

+50
-22
lines changed
900 Bytes
Loading
969 Bytes
Loading

_v2/moduleart-website/src/components/ProjectList/ProjectList.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@
1919

2020
.light {
2121
color: $light-color;
22+
font-weight: 500;
2223
}
23-
24-
2524
}
2625

2726
&__platform {
2827
display: inline;
28+
vertical-align: middle;
2929
}
3030

3131
&__image {

_v2/moduleart-website/src/components/ProjectList/ProjectList.vue

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,11 @@
22
<ul class="project-list">
33
<li v-for="(project, projectIndex) in projects" :key="projectIndex" class="project">
44
<h2 class="project__title">
5-
<a :href="project.url">
6-
<span>{{ project.title }}</span>
7-
<span class="light"> for </span>
8-
<tooltip class="project__platform" v-for="(platform, platformIndex) in project.platforms" :key="platformIndex" :text="platform">
9-
<img :src="getPlatformImage(platform)" :alt="platform" />
10-
</tooltip>
11-
</a>
5+
<a :href="project.url">{{ project.title }}</a>
6+
<span class="light"> for </span>
7+
<tooltip class="project__platform" v-for="(platform, platformIndex) in project.platforms" :key="platformIndex" :text="platform.title">
8+
<img :src="getPlatformImage(platform.name)" :alt="platform.title" />
9+
</tooltip>
1210
</h2>
1311
<a class="project__image">
1412
<img v-if="project.image" :src="getProjectImage(project.image)" :alt="project.title" />
@@ -33,17 +31,33 @@ export default {
3331
url: "https://moduleart.github.io/quick-picture-viewer",
3432
image: "quick-picture-viewer.png",
3533
platforms: [
36-
"windows",
34+
{
35+
name: "windows",
36+
title: "Windows",
37+
},
3738
],
3839
},
3940
{
4041
title: "Qsnip",
4142
url: "https://moduleart.github.io/qsnip",
4243
image: null,
4344
platforms: [
44-
"windows",
45-
"mac",
46-
"linux",
45+
{
46+
name: "windows",
47+
title: "Windows",
48+
},
49+
{
50+
name: "mac",
51+
title: "Mac",
52+
},
53+
{
54+
name: "ubuntu",
55+
title: "Linux (Ubuntu PPA)",
56+
},
57+
{
58+
name: "flatpak",
59+
title: "Linux (Flatpak)",
60+
},
4761
],
4862
},
4963
],

_v2/moduleart-website/src/components/Tooltip/Tooltip.scss

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,26 +4,38 @@
44
position: relative;
55

66
&:hover {
7-
.tooltip__text {
7+
.tooltip__holder {
88
opacity: 1;
9-
transform: translateX(-50%) translateY(0);
9+
transform: translateY(0);
1010
}
1111
}
1212

13+
&__holder {
14+
position: absolute;
15+
left: 0;
16+
top: 0;
17+
width: 100%;
18+
height: 100%;
19+
transform: translateY(-8px);
20+
opacity: 0;
21+
transition: opacity .25s, transform .25s;
22+
pointer-events: none;
23+
display: inline-block;
24+
}
25+
1326
&__text {
1427
position: absolute;
1528
background: $text-color;
1629
color: $light-color;
1730
border-radius: 4px;
1831
padding: 4px 8px;
19-
font-size: 17px;
20-
line-height: 17px;
32+
font-size: 15px;
33+
line-height: 15px;
2134
left: 50%;
22-
transform: translateX(-50%) translateY(-8px);
23-
pointer-events: none;
35+
transform: translateX(-50%);
2436
top: calc(-100% - 8px);
25-
opacity: 0;
26-
transition: opacity .25s, transform .25s;
37+
white-space: nowrap;
38+
text-align: center;
2739

2840
&::before {
2941
content: "";

_v2/moduleart-website/src/components/Tooltip/Tooltip.vue

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
<template>
22
<div class="tooltip">
33
<slot />
4-
<span class="tooltip__text">{{ computedText }}</span>
4+
<span class="tooltip__holder">
5+
<span class="tooltip__text">{{ computedText }}</span>
6+
</span>
57
</div>
68
</template>
79

0 commit comments

Comments
 (0)