|
3 | 3 | <div class="smartphone-only"> |
4 | 4 | <SfBottomNavigation class="navigation-bottom"> |
5 | 5 | <SfBottomNavigationItem |
6 | | - :class="$route.path == '/' ? 'sf-bottom-navigation__item--active' : ''" |
7 | | - icon="home" |
8 | | - size="20px" |
| 6 | + :class="{ 'sf-bottom-navigation__item--active': $route.name && $route.name.startsWith('home') }" |
9 | 7 | label="Home" |
10 | 8 | @click="$router.push(app.localePath('/')) && (isMobileMenuOpen ? toggleMobileMenu() : false)" |
11 | | - /> |
| 9 | + > |
| 10 | + <template #icon> |
| 11 | + <SvgImage |
| 12 | + icon="home" |
| 13 | + :label="$t('Home')" |
| 14 | + width="20" |
| 15 | + height="20" |
| 16 | + /> |
| 17 | + </template> |
| 18 | + </SfBottomNavigationItem> |
12 | 19 | <SfBottomNavigationItem |
13 | | - icon="menu" |
14 | | - size="20px" |
15 | 20 | label="Menu" |
16 | 21 | @click="toggleMobileMenu" |
17 | | - /> |
| 22 | + > |
| 23 | + <template #icon> |
| 24 | + <SvgImage |
| 25 | + icon="menu" |
| 26 | + :label="$t('Menu')" |
| 27 | + width="20" |
| 28 | + height="20" |
| 29 | + /> |
| 30 | + </template> |
| 31 | + </SfBottomNavigationItem> |
18 | 32 | <SfBottomNavigationItem |
19 | 33 | v-if="isAuthenticated" |
20 | | - icon="heart" |
21 | | - size="20px" |
22 | 34 | label="Wishlist" |
23 | 35 | @click="toggleWishlistSidebar" |
24 | | - /> |
| 36 | + > |
| 37 | + <template #icon> |
| 38 | + <SvgImage |
| 39 | + icon="heart" |
| 40 | + :label="$t('Wishlist')" |
| 41 | + width="20" |
| 42 | + height="20" |
| 43 | + /> |
| 44 | + </template> |
| 45 | + </SfBottomNavigationItem> |
25 | 46 | <SfBottomNavigationItem |
26 | | - icon="profile" |
27 | | - size="20px" |
28 | 47 | label="Account" |
29 | 48 | @click="handleAccountClick" |
30 | | - /> |
31 | | - <!-- TODO: add logic for label - if on Home then Basket, if on PDC then AddToCart etc. --> |
| 49 | + > |
| 50 | + <template #icon> |
| 51 | + <SvgImage |
| 52 | + icon="profile" |
| 53 | + :label="$t('Account')" |
| 54 | + width="20" |
| 55 | + height="20" |
| 56 | + /> |
| 57 | + </template> |
| 58 | + </SfBottomNavigationItem> |
32 | 59 | <SfBottomNavigationItem |
33 | | - label="Basket" |
34 | | - icon="add_to_cart" |
| 60 | + :label="$route.name && $route.name.startsWith('product') ? 'Add to Cart' : 'Basket'" |
35 | 61 | @click="toggleCartSidebar" |
36 | 62 | > |
37 | 63 | <template #icon> |
38 | 64 | <SfCircleIcon aria-label="Add to cart"> |
39 | | - <SfIcon |
| 65 | + <SvgImage |
40 | 66 | icon="add_to_cart" |
41 | | - color="white" |
42 | | - size="25px" |
43 | | - :style="{margin: '0 0 0 -2px'}" |
| 67 | + width="25" |
| 68 | + height="25" |
| 69 | + class="navigation-bottom__add-to-cart" |
44 | 70 | /> |
45 | 71 | </SfCircleIcon> |
46 | 72 | </template> |
|
51 | 77 | </template> |
52 | 78 |
|
53 | 79 | <script> |
54 | | -import { SfBottomNavigation, SfIcon, SfCircleIcon } from '@storefront-ui/vue'; |
| 80 | +import { SfBottomNavigation, SfCircleIcon } from '@storefront-ui/vue'; |
55 | 81 | import { useUser } from '@vue-storefront/magento'; |
56 | 82 | import { defineComponent, useRouter, useContext } from '@nuxtjs/composition-api'; |
57 | 83 | import { useUiState } from '~/composables'; |
58 | 84 | import MobileMenuSidebar from '~/components/MobileMenuSidebar.vue'; |
| 85 | +import SvgImage from '~/components/General/SvgImage.vue'; |
59 | 86 |
|
60 | 87 | export default defineComponent({ |
61 | 88 | components: { |
62 | 89 | SfBottomNavigation, |
63 | | - SfIcon, |
64 | 90 | SfCircleIcon, |
65 | 91 | MobileMenuSidebar, |
| 92 | + SvgImage, |
66 | 93 | }, |
67 | 94 | setup() { |
68 | 95 | const { |
@@ -98,5 +125,19 @@ export default defineComponent({ |
98 | 125 | <style lang="scss" scoped> |
99 | 126 | .navigation-bottom { |
100 | 127 | --bottom-navigation-z-index: 3; |
| 128 | +
|
| 129 | + &__add-to-cart { |
| 130 | + margin-left: -2px |
| 131 | + } |
| 132 | +
|
| 133 | + ::v-deep { |
| 134 | + .sf-bottom-navigation-item { |
| 135 | + align-self: end; |
| 136 | + } |
| 137 | +
|
| 138 | + .svg-image { |
| 139 | + margin-bottom: var(--spacer-xs); |
| 140 | + } |
| 141 | + } |
101 | 142 | } |
102 | 143 | </style> |
0 commit comments