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 a6b559d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 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
12 changes: 6 additions & 6 deletions ui/artalk-sidebar/src/components/AppNavigationMenu.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { storeToRefs } from 'pinia'
import { RouteLocation } from 'vue-router'
import CommentsIcon from '../assets/nav-icon-comments.svg'
import PagesIcon from '../assets/nav-icon-pages.svg'
import UsersIcon from '../assets/nav-icon-users.svg'
import SitesIcon from '../assets/nav-icon-sites.svg'
import TransferIcon from '../assets/nav-icon-transfer.svg'
import SettingsIcon from '../assets/nav-icon-settings.svg'
import CommentsIcon from '@/assets/nav-icon-comments.svg'
import PagesIcon from '@/assets/nav-icon-pages.svg'
import UsersIcon from '@/assets/nav-icon-users.svg'
import SitesIcon from '@/assets/nav-icon-sites.svg'
import TransferIcon from '@/assets/nav-icon-transfer.svg'
import SettingsIcon from '@/assets/nav-icon-settings.svg'
import { useUserStore } from '@/stores/user'
import { useNavStore } from '@/stores/nav'

Expand Down

0 comments on commit a6b559d

Please sign in to comment.