Skip to content

Commit

Permalink
chore(icon): fix icon in sidebar on desktop devices
Browse files Browse the repository at this point in the history
  • Loading branch information
qwqcode committed Aug 29, 2024
1 parent 67b37b4 commit 3d6d9c2
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions ui/artalk-sidebar/src/components/AppNavigationDesktop.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@
/**
* The part of the navigation bar that is displayed on desktop
*/
import SearchIcon from '../assets/nav-icon-search.svg'
import { useNavigationMenu } from './AppNavigationMenu'
const nav = useNavigationMenu()
const { t } = useI18n()
const getIconCSSAttribute = (icon: string) => `url('${icon.replace(/'/g, "\\'")}')`
</script>

<template>
Expand All @@ -18,7 +19,7 @@ const { t } = useI18n()
:class="{ active: pageName === nav.curtPage }"
@click="nav.goPage(pageName as string)"
>
<span class="icon" :style="{ background: `url('${page.icon}')` }"></span>
<span class="icon" :style="{ backgroundImage: getIconCSSAttribute(page.icon) }"></span>
{{ t(page.label) }}
</div>
</div>
Expand All @@ -37,7 +38,7 @@ const { t } = useI18n()

<div v-if="nav.isSearchEnabled" class="item-wrap search-btn" @click="nav.showSearch()">
<div class="item">
<div class="icon" :style="{ background: `url('${SearchIcon}')` }"></div>
<div class="icon"></div>
</div>
</div>
</div>
Expand Down Expand Up @@ -152,6 +153,10 @@ $colorMain: #8ecee2;
&.search-btn {
margin-left: auto;
.icon {
background-image: url('@/assets/nav-icon-search.svg');
}
}
.item {
Expand Down

0 comments on commit 3d6d9c2

Please sign in to comment.