Skip to content

Commit ee9f8ae

Browse files
fix: add title hover
1 parent 8f7fb33 commit ee9f8ae

File tree

3 files changed

+67
-34
lines changed

3 files changed

+67
-34
lines changed

website/src/components/Playground.vue

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,4 +149,56 @@ let codeMode = shallowRef('code')
149149
pointer-events: none;
150150
}
151151
}
152+
</style>
153+
154+
<style>
155+
@media only screen and (min-width: 780px) {
156+
.playground [data-title] {
157+
position: relative;
158+
}
159+
160+
.playground [data-title]:after {
161+
content: attr(data-title);
162+
position: absolute;
163+
color: var(--vp-c-white);
164+
background-color: rgba(0, 0, 0, 0.5);
165+
padding: 0.25em 0.5em;
166+
font-size: 10px;
167+
width: max-content;
168+
opacity: 0;
169+
transition: 0.2s;
170+
border-radius: 5px;
171+
pointer-events: none;
172+
}
173+
.playground [data-title]::before {
174+
position: absolute;
175+
width: 0;
176+
height: 0;
177+
display: block;
178+
border: 5px solid transparent;
179+
content: '';
180+
opacity: 0;
181+
transition: 0.2s;
182+
pointer-events: none;
183+
}
184+
.playground [title-left]::before {
185+
left: -10px;
186+
bottom: 50%;
187+
transform: translateY(50%);
188+
border-left-color: rgba(0, 0, 0, 0.5);
189+
}
190+
.playground [title-left]:after {
191+
left: -10px;
192+
bottom: 50%;
193+
transform: translate(-100%, 50%);
194+
}
195+
196+
.dark .playground [data-title]::after {
197+
color: var(--vp-c-brand-1);
198+
}
199+
200+
.playground [data-title]:hover::after, .playground [data-title]:hover::before {
201+
opacity: 1;
202+
}
203+
}
152204
</style>

website/src/components/SelectLang.vue

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,22 @@ const lang = defineModel<string>({
88
required: true,
99
})
1010
11-
const version = computed(() => {
12-
return versions[lang.value]
11+
const versionText = computed(() => {
12+
const ver = versions[lang.value]
13+
return ver ? `Parser version ${ver}` : 'No parser version info'
1314
})
1415
</script>
1516

1617
<template>
1718
<div class="selector">
18-
<span v-if="version" :title="`Parser version ${version}`">ⓘ </span>
19-
Language:
19+
<span
20+
class="parser-icon"
21+
title-left
22+
:data-title="versionText"
23+
>
24+
25+
Language:
26+
</span>
2027
<select v-model="lang">
2128
<option
2229
class="selector-option-text"
@@ -48,4 +55,7 @@ select {
4855
display: none;
4956
}
5057
}
58+
.parser-icon {
59+
cursor: help;
60+
}
5161
</style>

website/src/components/Toolbars.vue

Lines changed: 1 addition & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ async function onShare() {
2222

2323
<template>
2424
<div class="toolbars">
25-
<button class="floating" data-title="Copy your code URL to share!" @click="onShare">
25+
<button class="floating" data-title="Copy your code URL to share!" title-left @click="onShare">
2626
<Share style="width: 24px; height: 24px;"/>
2727
</button>
2828
<button
@@ -65,35 +65,6 @@ async function onShare() {
6565
color: var(--vp-c-brand);
6666
}
6767
68-
@media only screen and (min-width: 780px) {
69-
[data-title] {
70-
position: relative;
71-
}
72-
73-
[data-title]:after {
74-
content: attr(data-title);
75-
position: absolute;
76-
left: -10%;
77-
bottom: 50%;
78-
color: var(--vp-c-white);
79-
background-color: rgba(0, 0, 0, 0.5);
80-
padding: 0.25em 0.5em;
81-
font-size: 10px;
82-
width: max-content;
83-
opacity: 0;
84-
transform: translate(-100%, 50%);
85-
transition: 0.2s;
86-
border-radius: 5px;
87-
}
88-
89-
.dark [data-title]:after {
90-
color: var(--vp-c-brand-1);
91-
}
92-
93-
[data-title]:hover:after {
94-
opacity: 1;
95-
}
96-
}
9768
.switch {
9869
display: none;
9970
border-radius: 5px 5px 0px 0px;

0 commit comments

Comments
 (0)