2019-02-19 00:27:52 +00:00
|
|
|
{#if showBadge}
|
|
|
|
<div class="nav-link-svg-wrapper">
|
2019-03-03 03:02:06 +00:00
|
|
|
<SvgIcon className="nav-link-svg" href={svg} />
|
2019-02-19 00:27:52 +00:00
|
|
|
<span class="nav-link-badge nav-link-badge-digits-{badgeDigits}" aria-hidden="true">
|
|
|
|
{badgeNumberToShow}
|
|
|
|
</span>
|
|
|
|
</div>
|
|
|
|
{:else}
|
2019-03-03 03:02:06 +00:00
|
|
|
<SvgIcon className="nav-link-svg" href={svg} />
|
2019-02-19 00:27:52 +00:00
|
|
|
{/if}
|
|
|
|
<style>
|
|
|
|
.nav-link-svg-wrapper {
|
|
|
|
position: relative;
|
|
|
|
display: inline-block;
|
|
|
|
}
|
|
|
|
|
2019-03-03 03:02:06 +00:00
|
|
|
:global(.nav-link-svg-wrapper, .nav-link-svg) {
|
2019-09-21 06:17:57 +00:00
|
|
|
width: var(--nav-icon-width);
|
|
|
|
height: var(--nav-icon-height);
|
2019-02-19 00:27:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.nav-link-badge {
|
|
|
|
position: absolute;
|
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
justify-content: center;
|
|
|
|
top: 0;
|
|
|
|
right: 0;
|
|
|
|
bottom: 0;
|
|
|
|
left: 0;
|
|
|
|
transform: translate(10px, 7px);
|
|
|
|
z-index: 10;
|
|
|
|
border: 1px solid var(--nav-bg);
|
|
|
|
background: var(--nav-svg-fill);
|
|
|
|
color: var(--nav-bg);
|
|
|
|
border-radius: 100%;
|
|
|
|
font-size: 0.8em;
|
|
|
|
margin: 0 0 3px;
|
|
|
|
font-weight: 600;
|
|
|
|
}
|
|
|
|
|
|
|
|
.nav-link-badge-digits-2 {
|
|
|
|
font-size: 0.7em;
|
|
|
|
}
|
|
|
|
|
|
|
|
.nav-link-badge-digits-3 {
|
|
|
|
font-size: 0.6em;
|
|
|
|
}
|
|
|
|
|
2019-03-03 03:02:06 +00:00
|
|
|
:global(.nav-link-svg) {
|
2019-02-19 00:27:52 +00:00
|
|
|
display: inline-block;
|
|
|
|
fill: var(--nav-svg-fill);
|
|
|
|
}
|
|
|
|
|
|
|
|
:global(.main-nav-link:hover .nav-link-svg) {
|
|
|
|
fill: var(--nav-svg-fill-hover);
|
|
|
|
}
|
|
|
|
|
|
|
|
@media (max-width: 991px) {
|
|
|
|
.nav-link-badge {
|
|
|
|
transform: translate(15px, 7px);
|
|
|
|
margin: 2px 1px 4px;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|
|
|
|
<script>
|
2019-03-03 03:02:06 +00:00
|
|
|
import SvgIcon from './SvgIcon.html'
|
|
|
|
|
2019-02-19 00:27:52 +00:00
|
|
|
export default {
|
|
|
|
data: () => ({
|
|
|
|
showBadge: false,
|
|
|
|
badgeNumber: 0
|
|
|
|
}),
|
|
|
|
computed: {
|
|
|
|
badgeDigits: ({ badgeNumber }) => Math.min(3, badgeNumber.toString().length),
|
|
|
|
badgeNumberToShow: ({ badgeNumber }) => (badgeNumber < 100 ? badgeNumber.toString() : '99+')
|
2019-03-03 03:02:06 +00:00
|
|
|
},
|
|
|
|
components: {
|
|
|
|
SvgIcon
|
2019-02-19 00:27:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|