Skip to content

Commit 9c4877e

Browse files
committed
platform tooltips
1 parent 4b1633c commit 9c4877e

File tree

5 files changed

+81
-13
lines changed

5 files changed

+81
-13
lines changed

_v2/moduleart-website/README.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,3 @@ yarn build
1919
```
2020
yarn lint
2121
```
22-
23-
### Customize configuration
24-
See [Configuration Reference](https://cli.vuejs.org/config/).

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,11 @@
2121
color: $light-color;
2222
}
2323

24-
img {
25-
margin-right: 4px;
26-
}
24+
25+
}
26+
27+
&__platform {
28+
display: inline;
2729
}
2830

2931
&__image {

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

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,10 @@
55
<a :href="project.url">
66
<span>{{ project.title }}</span>
77
<span class="light"> for </span>
8-
<img
9-
v-for="(platform, platformIndex) in project.platforms"
10-
:key="platformIndex"
11-
:src="getPlatformImage(platform)"
12-
:alt="platform"
13-
:title="platform"
14-
/></a>
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>
1512
</h2>
1613
<a class="project__image">
1714
<img v-if="project.image" :src="getProjectImage(project.image)" :alt="project.title" />
@@ -21,8 +18,13 @@
2118
</template>
2219

2320
<script>
21+
import Tooltip from "../Tooltip/Tooltip.vue";
22+
2423
export default {
2524
name: "ProjectList",
25+
components: {
26+
Tooltip,
27+
},
2628
data() {
2729
return {
2830
projects: [
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
@import "../../assets/styles/variables.scss";
2+
3+
.tooltip {
4+
position: relative;
5+
6+
&:hover {
7+
.tooltip__text {
8+
opacity: 1;
9+
transform: translateX(-50%) translateY(0);
10+
}
11+
}
12+
13+
&__text {
14+
position: absolute;
15+
background: $text-color;
16+
color: $light-color;
17+
border-radius: 4px;
18+
padding: 4px 8px;
19+
font-size: 17px;
20+
line-height: 17px;
21+
left: 50%;
22+
transform: translateX(-50%) translateY(-8px);
23+
pointer-events: none;
24+
top: calc(-100% - 8px);
25+
opacity: 0;
26+
transition: opacity .25s, transform .25s;
27+
28+
&::before {
29+
content: "";
30+
width: 0;
31+
height: 0;
32+
top: 100%;
33+
left: calc(50% - 8px);
34+
border-left: 8px solid transparent;
35+
border-right: 8px solid transparent;
36+
border-top: 8px solid $text-color;
37+
position: absolute;
38+
}
39+
}
40+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<template>
2+
<div class="tooltip">
3+
<slot />
4+
<span class="tooltip__text">{{ computedText }}</span>
5+
</div>
6+
</template>
7+
8+
<script>
9+
export default {
10+
name: "Tooltip",
11+
props: {
12+
text: {
13+
type: String,
14+
default: "",
15+
},
16+
},
17+
computed: {
18+
computedText() {
19+
return this.text;
20+
},
21+
},
22+
};
23+
</script>
24+
25+
<style lang="scss">
26+
@import "./Tooltip.scss";
27+
</style>

0 commit comments

Comments
 (0)