-
Notifications
You must be signed in to change notification settings - Fork 9
/
Header.vue
39 lines (39 loc) · 1.31 KB
/
Header.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<template>
<header class="font-bold text-xl py-3 flex">
{{ title }}
<button
v-if="shareFeature"
class="ml-auto opacity-50 hover:opacity-75"
@click="openShareDialog()"
>
<svg :style="{ width: '1em', height: '1em' }" viewBox="0 0 24 24">
<path
fill="currentColor"
d="M18,16.08C17.24,16.08 16.56,16.38 16.04,16.85L8.91,12.7C8.96,12.47 9,12.24 9,12C9,11.76 8.96,11.53 8.91,11.3L15.96,7.19C16.5,7.69 17.21,8 18,8A3,3 0 0,0 21,5A3,3 0 0,0 18,2A3,3 0 0,0 15,5C15,5.24 15.04,5.47 15.09,5.7L8.04,9.81C7.5,9.31 6.79,9 6,9A3,3 0 0,0 3,12A3,3 0 0,0 6,15C6.79,15 7.5,14.69 8.04,14.19L15.16,18.34C15.11,18.55 15.08,18.77 15.08,19C15.08,20.61 16.39,21.91 18,21.91C19.61,21.91 20.92,20.61 20.92,19A2.92,2.92 0 0,0 18,16.08Z"
/>
</svg>
</button>
</header>
</template>
<script>
export default {
data() {
return {
title: 'ToDo PWA (VueJS)',
shareFeature: 'share' in navigator,
};
},
methods: {
openShareDialog: function() {
navigator
.share({
title: this.title,
text: 'A progressive ToDo List written in preactJS',
url: 'https://todo-pwa.nico.dev/vue/',
})
.then(() => console.log('Successful share'))
.catch(error => console.log('Error sharing', error));
},
},
};
</script>