forked from Stigmatoz/web-activity-time-tracker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFavicon.vue
More file actions
45 lines (40 loc) · 880 Bytes
/
Favicon.vue
File metadata and controls
45 lines (40 loc) · 880 Bytes
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
40
41
42
43
44
45
<template>
<div class="container">
<img v-if="faviconNotValid" class="favicon no-favicon" height="22" :src="NO_FAVICON" />
<img v-else class="favicon" height="30" :src="favicon" />
</div>
</template>
<script lang="ts">
export default {
name: 'Favicon',
};
</script>
<script lang="ts" setup>
import { computed } from 'vue';
import { NO_FAVICON } from '../utils/consts';
import { TypeOfUrl } from '../utils/enums';
const props = defineProps<{
favicon: string | undefined;
type: TypeOfUrl;
}>();
const faviconNotValid = computed(
() =>
props.favicon == undefined ||
props.favicon == '' ||
props.favicon.startsWith('chrome://favicon/') ||
props.type == TypeOfUrl.Document,
);
</script>
<style scoped>
.container {
display: inline-block;
height: 30px;
width: 40px;
}
.favicon {
padding: 5px;
}
.no-favicon {
margin: 0 5px;
}
</style>