Skip to content

Commit ad453c1

Browse files
committed
copyUrl
1 parent e56373c commit ad453c1

File tree

3 files changed

+108
-3
lines changed

3 files changed

+108
-3
lines changed

apps/web/app/pages/namecard/[id]/share.vue

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,15 @@ if (!attendee) {
1717
1818
const currentLocale = useLocaleCurrent().locale
1919
20+
function copyUrl() {
21+
const element = document.createElement('input')
22+
element.value = `https://vuefes.jp/2024/namecard/${id}/share`
23+
document.body.appendChild(element)
24+
element.select()
25+
document.execCommand('copy')
26+
document.body.removeChild(element)
27+
}
28+
2029
const officialSiteUrl = computed(() => {
2130
return currentLocale.value === 'ja' ? linkUrl : `${linkUrl}/en`
2231
})
@@ -73,7 +82,12 @@ useHead({
7382
/>
7483
</li>
7584
<li>
76-
<VFIcon color="vue-blue" name="external" :can-hover="false" />
85+
<div class="copycode">
86+
<VFCssResetButton @click="copyUrl">
87+
<VFIcon color="vue-blue" name="external" :can-hover="false" />
88+
</VFCssResetButton>
89+
<span>コピーしました!</span>
90+
</div>
7791
</li>
7892
</ul>
7993
</div>
@@ -118,4 +132,25 @@ useHead({
118132
padding: 0;
119133
margin: 0;
120134
}
135+
.copycode {
136+
position: relative;
137+
display: inline-block;
138+
}
139+
.copycode span {
140+
opacity: 0;
141+
position: absolute;
142+
top: 0px;
143+
right: -5px;
144+
color: #fff;
145+
background: rgba(0, 0, 0, 0.5);
146+
padding: 2px 5px;
147+
transform: translate(100%);
148+
}
149+
.copycode button:focus + span {
150+
animation: fade-out 2s ease-in;
151+
}
152+
@keyframes fade-out {
153+
0% { visibility: visible; opacity: 1; }
154+
100% { visibility: hidden; opacity: 0; }
155+
}
121156
</style>

apps/web/app/pages/sessions/[id]/share.vue

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,15 @@ if (!speakerData[0].detail_page_id) {
2222
2323
const currentLocale = useLocaleCurrent().locale
2424
25+
function copyUrl() {
26+
const element = document.createElement('input')
27+
element.value = `https://vuefes.jp/2024/namecard/${id}/share`
28+
document.body.appendChild(element)
29+
element.select()
30+
document.execCommand('copy')
31+
document.body.removeChild(element)
32+
}
33+
2534
useHead({
2635
titleTemplate: (titleChunk) => `${conferenceTitle}`,
2736
meta: [
@@ -81,7 +90,12 @@ useHead({
8190
/>
8291
</li>
8392
<li>
84-
<VFIcon color="vue-blue" name="external" :can-hover="false" />
93+
<div class="copycode">
94+
<VFCssResetButton @click="copyUrl">
95+
<VFIcon color="vue-blue" name="external" :can-hover="false" />
96+
</VFCssResetButton>
97+
<span>コピーしました!</span>
98+
</div>
8599
</li>
86100
</ul>
87101
</div>
@@ -126,4 +140,25 @@ useHead({
126140
padding: 0;
127141
margin: 0;
128142
}
143+
.copycode {
144+
position: relative;
145+
display: inline-block;
146+
}
147+
.copycode span {
148+
opacity: 0;
149+
position: absolute;
150+
top: 0px;
151+
right: -5px;
152+
color: #fff;
153+
background: rgba(0, 0, 0, 0.5);
154+
padding: 2px 5px;
155+
transform: translate(100%);
156+
}
157+
.copycode button:focus + span {
158+
animation: fade-out 2s ease-in;
159+
}
160+
@keyframes fade-out {
161+
0% { visibility: visible; opacity: 1; }
162+
100% { visibility: hidden; opacity: 0; }
163+
}
129164
</style>

apps/web/app/pages/sponsors/[id]/share.vue

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,15 @@ if (!sponsorData[0].detail_page_id) {
2222
2323
const currentLocale = useLocaleCurrent().locale
2424
25+
function copyUrl() {
26+
const element = document.createElement('input')
27+
element.value = `https://vuefes.jp/2024/namecard/${id}/share`
28+
document.body.appendChild(element)
29+
element.select()
30+
document.execCommand('copy')
31+
document.body.removeChild(element)
32+
}
33+
2534
useHead({
2635
titleTemplate: (titleChunk) => `${conferenceTitle}`,
2736
meta: [
@@ -81,7 +90,12 @@ useHead({
8190
/>
8291
</li>
8392
<li>
84-
<VFIcon color="vue-blue" name="external" :can-hover="false" />
93+
<div class="copycode">
94+
<VFCssResetButton @click="copyUrl">
95+
<VFIcon color="vue-blue" name="external" :can-hover="false" />
96+
</VFCssResetButton>
97+
<span>コピーしました!</span>
98+
</div>
8599
</li>
86100
</ul>
87101
</div>
@@ -126,4 +140,25 @@ useHead({
126140
padding: 0;
127141
margin: 0;
128142
}
143+
.copycode {
144+
position: relative;
145+
display: inline-block;
146+
}
147+
.copycode span {
148+
opacity: 0;
149+
position: absolute;
150+
top: 0px;
151+
right: -5px;
152+
color: #fff;
153+
background: rgba(0, 0, 0, 0.5);
154+
padding: 2px 5px;
155+
transform: translate(100%);
156+
}
157+
.copycode button:focus + span {
158+
animation: fade-out 8s ease-in;
159+
}
160+
@keyframes fade-out {
161+
0% { visibility: visible; opacity: 1; }
162+
100% { visibility: hidden; opacity: 0; }
163+
}
129164
</style>

0 commit comments

Comments
 (0)