tangled
alpha
login
or
join now
finxol.io
/
blog
0
fork
atom
Personal blog
finxol.io
blog
0
fork
atom
overview
issues
pulls
pipelines
feat: add tooltip to country tag
finxol.io
6 months ago
94135b3a
fba52457
verified
This commit was signed with the committer's
known signature
.
finxol.io
SSH Key Fingerprint:
SHA256:olFE3asYdoBMScuJOt60UxXdJ0RFdGv5kVKrdOtIcPI=
+52
-7
1 changed file
expand all
collapse all
unified
split
app
components
Country.vue
+52
-7
app/components/Country.vue
reviewed
···
17
17
18
18
<template>
19
19
<div v-if="data" class="hidden md:flex flex-row items-center gap-2">
20
20
-
<span>
21
21
-
Currently in:
22
22
-
</span>
23
23
-
<div class="flex flex-row items-center gap-2 bg-stone-200/50 dark:bg-stone-700/60 py-1 px-2 rounded-lg">
24
24
-
<span>
20
20
+
<div class="tooltip-target flex flex-row items-center gap-2 bg-stone-200/50 dark:bg-stone-700/60 py-1 px-2 rounded-lg">
21
21
+
I'm in
22
22
+
<span class="flex flex-row items-center gap-2 font-bold">
25
23
{{ emoji }}
26
26
-
</span>
27
27
-
<span>
28
24
{{ country }}
29
25
</span>
26
26
+
!
27
27
+
</div>
28
28
+
29
29
+
<div class="anchored-tooltip">
30
30
+
This gets automatically updated as I move around!
30
31
</div>
31
32
</div>
32
33
</template>
34
34
+
35
35
+
<style scoped>
36
36
+
.tooltip-target:hover + .anchored-tooltip {
37
37
+
display: block;
38
38
+
}
39
39
+
40
40
+
.tooltip-target {
41
41
+
anchor-name: --infobox;
42
42
+
}
43
43
+
44
44
+
.anchored-tooltip {
45
45
+
@apply text-stone-200;
46
46
+
47
47
+
--bg-color: oklch(0.3272 0.0197 88.15 / 80%);
48
48
+
49
49
+
display: none;
50
50
+
51
51
+
position-anchor: --infobox;
52
52
+
position: absolute;
53
53
+
margin: 0;
54
54
+
top: calc(anchor(top) + 3rem);
55
55
+
left: calc(anchor(center));
56
56
+
transform: translateX(-50%);
57
57
+
bottom: anchor(bottom);
58
58
+
height: fit-content;
59
59
+
width: fit-content;
60
60
+
max-width: 15rem;
61
61
+
padding: 0.5rem 1rem;
62
62
+
text-align: center;
63
63
+
background-color: var(--bg-color);
64
64
+
border-radius: 0.5rem;
65
65
+
66
66
+
&::before {
67
67
+
content: "";
68
68
+
position: absolute;
69
69
+
top: -10px;
70
70
+
left: 50%;
71
71
+
transform: translateX(-50%) rotate(180deg);
72
72
+
border-width: 10px 10px 0 10px;
73
73
+
border-style: solid;
74
74
+
border-color: var(--bg-color) transparent transparent transparent;
75
75
+
}
76
76
+
}
77
77
+
</style>