CustomNavBarTranslations.vue 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <script lang="ts" setup>
  2. import VPFlyout from 'vitepress/dist/client/theme-default/components/VPFlyout.vue'
  3. import VPMenuLink from 'vitepress/dist/client/theme-default/components/VPMenuLink.vue'
  4. import { useData } from 'vitepress/dist/client/theme-default/composables/data'
  5. import { useLangs } from 'vitepress/dist/client/theme-default/composables/langs'
  6. const { theme } = useData()
  7. const { localeLinks, currentLang } = useLangs({ correspondingLink: true })
  8. </script>
  9. <template>
  10. <VPFlyout
  11. v-if="localeLinks.length && currentLang.label"
  12. class="VPNavBarTranslations"
  13. icon="vpi-languages"
  14. :label="theme.langMenuLabel || 'Change language'"
  15. >
  16. <div class="items">
  17. <p class="title">{{ currentLang.label }}</p>
  18. <template v-for="locale in localeLinks" :key="locale.link">
  19. <VPMenuLink :item="locale" />
  20. </template>
  21. </div>
  22. </VPFlyout>
  23. </template>
  24. <style scoped>
  25. .VPNavBarTranslations {
  26. display: flex;
  27. align-items: center;
  28. }
  29. .title {
  30. padding: 0 24px 0 12px;
  31. line-height: 32px;
  32. font-size: 14px;
  33. font-weight: 700;
  34. color: var(--vp-c-text-1);
  35. }
  36. </style>