Skip to content

Commit aa25189

Browse files
Add email icon and copy to clipboard
1 parent fe87697 commit aa25189

File tree

5 files changed

+63
-7
lines changed

5 files changed

+63
-7
lines changed
Lines changed: 44 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,60 @@
11
<script>
2-
import { computed } from 'vue';
3-
42
export default {
53
props: {
64
icon: String,
75
link: String,
86
},
7+
data() {
8+
return {
9+
showNotification: false
10+
};
11+
},
912
computed: {
1013
svg() {
1114
return `<span class="i-social-${this.icon}" />`;
1215
},
16+
},
17+
methods: {
18+
handleClick() {
19+
if (this.icon === 'email') {
20+
navigator.clipboard.writeText(this.link).then(() => {
21+
this.showNotification = true;
22+
setTimeout(() => {
23+
this.showNotification = false;
24+
}, 1000);
25+
}, (err) => {
26+
console.error('Failed to copy email: ', err);
27+
});
28+
} else {
29+
window.open(this.link, '_blank', 'noopener');
30+
}
31+
},
1332
}
1433
}
1534
</script>
1635

1736
<template>
18-
<a class="flex justify-center items-center w-9 h-9 text-gray-600 transition-color duration-500 hover:text-custom-orange hover:duration-300"
19-
:href="link" target="_blank" rel="noopener" v-html="svg"></a>
37+
<transition name="fade">
38+
<div v-if="showNotification"
39+
class="fixed top-2 left-1/2 transform -translate-x-1/2 border-2 border-custom-orange bg-white text-custom-orange text-center py-2 px-4 rounded-lg">
40+
Email address copied to clipboard!
41+
</div>
42+
</transition>
43+
<div @click.stop="handleClick"
44+
class="flex justify-center items-center w-9 h-9 text-gray-600 transition-color duration-500 hover:text-custom-orange hover:duration-300"
45+
v-html="svg">
46+
</div>
2047
</template>
48+
49+
<style>
50+
/* Fade transition */
51+
.fade-enter-active,
52+
.fade-leave-active {
53+
transition: opacity 0.5s ease;
54+
}
55+
56+
.fade-enter,
57+
.fade-leave-to {
58+
opacity: 0;
59+
}
60+
</style>

.vitepress/theme/components/TeamMembersItem.vue

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,22 @@ export default {
1010
type: Object,
1111
required: true
1212
}
13+
},
14+
methods: {
15+
navigate(url) {
16+
if (url) {
17+
window.location.href = url;
18+
}
19+
}
1320
}
1421
}
1522
</script>
1623

1724
<template>
1825
<article
1926
class="hover:shadow-lg hover:shadow-custom-orange flex flex-col gap-px rounded-lg w-full h-full overflow-hidden transition-shadow duration-300 ease-in-out">
20-
<a :href="member.url" class="py-8 px-6 sm:py-12 sm:px-8 flex-grow bg-custom-soft no-underline">
27+
<div :href="member.url" class="py-8 px-6 sm:py-12 sm:px-8 flex-grow bg-custom-soft cursor-pointer"
28+
@click="navigate(member.url)">
2129
<figure class="relative shrink-0 mx-auto rounded-full shadow w-24 h-24">
2230
<img class="absolute inset-0 rounded-full object-cover" :src="member.image" :alt="member.name" />
2331
</figure>
@@ -35,6 +43,6 @@ export default {
3543
<SocialLink v-for="{ link, icon } in member.links" :key="link" :icon="icon" :link="link" />
3644
</div>
3745
</div>
38-
</a>
46+
</div>
3947
</article>
4048
</template>

.vitepress/theme/icons.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@
4141
--icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2C6.486 2 2 6.486 2 12s4.486 10 10 10 10-4.486 10-10S17.514 2 12 2zm7.931 9h-2.764a14.67 14.67 0 0 0-1.792-6.243A8.013 8.013 0 0 1 19.931 11zM12.53 4.027c1.035 1.364 2.427 3.78 2.627 6.973H9.03c.139-2.596.994-5.028 2.451-6.974.172-.01.344-.026.519-.026.179 0 .354.016.53.027zm-3.842.7C7.704 6.618 7.136 8.762 7.03 11H4.069a8.013 8.013 0 0 1 4.619-6.273zM4.069 13h2.974c.136 2.379.665 4.478 1.556 6.23A8.01 8.01 0 0 1 4.069 13zm7.381 6.973C10.049 18.275 9.222 15.896 9.041 13h6.113c-.208 2.773-1.117 5.196-2.603 6.972-.182.012-.364.028-.551.028-.186 0-.367-.016-.55-.027zm4.011-.772c.955-1.794 1.538-3.901 1.691-6.201h2.778a8.005 8.005 0 0 1-4.469 6.201z'/%3E%3C/svg%3E");
4242
}
4343

44+
.i-social-email {
45+
--icon: url("data:image/svg+xml,%3Csvg fill='%23000000' viewBox='0 0 1920 1920' xmlns='http://www.w3.org/2000/svg'%3E%3Cg id='SVGRepo_bgCarrier' stroke-width='0'%3E%3C/g%3E%3Cg id='SVGRepo_tracerCarrier' stroke-linecap='round' stroke-linejoin='round'%3E%3C/g%3E%3Cg id='SVGRepo_iconCarrier'%3E%3Cpath d='M0 1694.235h1920V226H0v1468.235ZM112.941 376.664V338.94H1807.06v37.723L960 1111.233l-847.059-734.57ZM1807.06 526.198v950.513l-351.134-438.89-88.32 70.475 378.353 472.998H174.042l378.353-472.998-88.32-70.475-351.134 438.89V526.198L960 1260.768l847.059-734.57Z' fill-rule='evenodd'%3E%3C/path%3E%3C/g%3E%3C/svg%3E");
46+
}
47+
4448
.i-menu {
4549
--icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill-rule='evenodd' d='M2.5 12a.5.5 0 0 1 .5-.5h10a.5.5 0 0 1 0 1H3a.5.5 0 0 1-.5-.5m0-4a.5.5 0 0 1 .5-.5h10a.5.5 0 0 1 0 1H3a.5.5 0 0 1-.5-.5m0-4a.5.5 0 0 1 .5-.5h10a.5.5 0 0 1 0 1H3a.5.5 0 0 1-.5-.5' /%3E%3C/svg%3E");
4650
}

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,11 +92,13 @@ name: "Will Hannon" # <-------------- Your preferred name
9292
image: "/assets/people/will-hannon.jpeg" # <-------------- The path to an image of you (a link also works)
9393
title: "Data Scientist" # <-------------- Your title. Please be as consistent as possible
9494
category: "Staff" # <-------------- One of [Graduate Students, Postdocs, or Staff]
95-
links: # <-------------- Links to your socials. Icons should be one of [github, linkedin, orcid, twitter, or website]
95+
links: # <-------------- Links to your socials. Icons should be one of [github, linkedin, orcid, twitter, email, or website]
9696
- link: "https://github.com/WillHannon-MCB"
9797
icon: "github"
9898
- link: "https://www.linkedin.com/in/williamhannon/"
9999
icon: "linkedin"
100+
101+
icon: "email"
100102
---
101103
```
102104

people/will-hannon.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ links:
99
icon: "github"
1010
- link: "https://www.linkedin.com/in/williamhannon/"
1111
icon: "linkedin"
12+
13+
icon: "email"
1214
---
1315

1416
As a Data Scientist in the Bloom Lab, I develop and implement computational approaches to study viral evolution and communicate with our data. I’m interested in improving access to the information-rich datasets we generate to aid in antigen engineering, therapeutic design, viral surveillance, and gaining a better understanding of viral evolution.

0 commit comments

Comments
 (0)