Skip to content

Commit

Permalink
fix: размер иконки в списке ссылок
Browse files Browse the repository at this point in the history
  • Loading branch information
ivanmem committed Nov 1, 2024
1 parent 869a9e8 commit 45e02c5
Showing 1 changed file with 20 additions and 15 deletions.
35 changes: 20 additions & 15 deletions src/contentScripts/views/App.vue
Original file line number Diff line number Diff line change
@@ -1,37 +1,41 @@
<script lang="ts" setup>
import {disableExtension, sitesStorage} from '~/logic'
import {useShikimoriMetaName} from '~/composables/useShikimoriMetaName'
import {templateSearch} from '~/common/consts'
import {getIconUrl} from "~/utils/getIconUrl";
import { disableExtension, sitesStorage } from '~/logic'
import { useShikimoriMetaName } from '~/composables/useShikimoriMetaName'
import { templateSearch } from '~/common/consts'
import { getIconUrl } from '~/utils/getIconUrl'
const {el, metaName} = useShikimoriMetaName()
const { el, metaName } = useShikimoriMetaName()
const sites = computed(() => sitesStorage.value.map((url) => {
try {
const name = escape(metaName.value)
if (url.includes(templateSearch)) {
url = url.replace(templateSearch, name)
} else {
}
else {
url += name
}
return new URL(url)
} catch (e) {
console.error({e})
return {host: 'error'}
}
catch (e) {
console.error({ e })
return { host: 'error' }
}
}))
</script>

<template>
<teleport v-if="!disableExtension && el" :to="el" defer>
<div v-for="site of sites" :key="site.toString()"
class="b-external_link official_site b-menu-line shiki-search-extension">
<div
v-for="site of sites" :key="site.toString()"
class="b-external_link official_site b-menu-line shiki-search-extension"
>
<a
v-if="site"
:href="site.toString()"
:style="{'--b-link-icon': `url(${getIconUrl(site.toString())})`}"
class="b-link"
v-if="site"
:href="site.toString()"
:style="{ '--b-link-icon': `url(${getIconUrl(site.toString())})` }"
class="b-link"
>
{{ site.host }}
</a>
Expand All @@ -44,6 +48,7 @@ const sites = computed(() => sitesStorage.value.map((url) => {
.b-link {
&::before {
background: var(--b-link-icon) no-repeat !important;
background-size: contain !important;
}
}
}
Expand Down

0 comments on commit 45e02c5

Please sign in to comment.