This repository has been archived on 2024-07-22. You can view files and clone it, but cannot push or open issues or pull requests.
Zaimki/components/ProfileLink.vue

49 lines
1.4 KiB
Vue
Raw Normal View History

<template>
<span>
2021-06-27 03:16:14 -07:00
<Icon :v="niceLink.icon" :set="niceLink.iconSet || 'l'"/>
<a :href="linkTrimmed" target="_blank" :rel="verifiedBy ? 'me' : 'noopener'">{{niceLink.text}}</a>
<button class="btn btn-sm p-0" v-if="verifiedBy" @click="verificationInfo">
2022-04-23 14:10:23 -07:00
<Icon v="shield-check" set="s" class="small text-primary"/>
</button>
</span>
</template>
<script>
2021-06-27 03:16:14 -07:00
import link from '../plugins/link';
export default {
2021-06-27 03:16:14 -07:00
mixins: [link],
props: {
link: { required: true },
2021-09-07 08:37:24 -07:00
expand: { type: Boolean },
2021-12-14 06:15:27 -08:00
verifiedLinks: { 'default': () => {return {}} },
},
computed: {
2021-01-21 12:04:56 -08:00
linkTrimmed() {
return this.link.trim();
},
2021-06-27 03:16:14 -07:00
niceLink() {
2021-12-14 06:15:27 -08:00
return this.beautifyLink(this.linkTrimmed, this.expand, this.verifiedBy);
},
2021-12-14 06:15:27 -08:00
verifiedBy() {
return this.verifiedLinks[this.link];
},
},
methods: {
async verificationInfo() {
await this.$alert({
icon: 'shield-check',
header: this.$t('profile.verifiedLinks.header'),
message: this.$t('profile.verifiedLinks.info')
});
},
},
};
</script>
<style lang="scss" scoped>
.icon {
height: 1em;
}
</style>