Repository navigation
Added an download link in the top nav bar #406
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,13 +1,16 @@ | ||
| <script setup lang="ts"> | ||
| import { useRoute } from "vitepress"; | ||
| import { computed, inject, ref } from "vue"; | ||
| import Icon from "./Icon.vue"; | ||
|
|
||
| const props = defineProps<{ | ||
| text: string; | ||
| link: string; | ||
| activeMatch: string; | ||
| items?: { text: string; link: string }[]; | ||
| screenMenu?: boolean; | ||
| button?: boolean; | ||
| icon?: string; | ||
| }>(); | ||
|
|
||
| const route = useRoute(); | ||
|
|
@@ -38,8 +41,9 @@ function isChildActive(link: string) { | |
| <a | ||
| v-if="!screenMenu" | ||
| :href="props.link" | ||
| :class="['VPNavBarMenuLink', { active: isActive }]" | ||
| :class="['VPNavBarMenuLink', { active: isActive, 'nav-button': props.button }]" | ||
| > | ||
| <Icon v-if="props.icon" :icon="props.icon" aria-hidden="true" /> | ||
| <span>{{ props.text }}</span> | ||
| </a> | ||
|
|
||
|
|
@@ -48,9 +52,10 @@ function isChildActive(link: string) { | |
| v-else-if="!props.items" | ||
| :href="props.link" | ||
| class="VPNavBarMenuLink mobile-nav-single-link" | ||
| :class="{ active: isActive }" | ||
| :class="{ active: isActive, 'nav-button': props.button }" | ||
| @click="closeScreen?.()" | ||
| > | ||
| <Icon v-if="props.icon" :icon="props.icon" aria-hidden="true" /> | ||
| <span>{{ props.text }}</span> | ||
| </a> | ||
|
|
||
|
|
@@ -207,4 +212,34 @@ function isChildActive(link: string) { | |
| .mobile-nav-link.active { | ||
| color: var(--vp-c-brand-1); | ||
| } | ||
|
|
||
| .VPNavBarMenuLink.nav-button { | ||
| display: inline-flex; | ||
| align-items: center; | ||
| align-self: center; | ||
| gap: 8px; | ||
| margin: 0 12px; | ||
| padding: 8px 14px; | ||
| border: none; | ||
| border-radius: 6px; | ||
| background-color: var(--vp-c-brand-3); | ||
| color: #fff; | ||
| line-height: 20px; | ||
| white-space: nowrap; | ||
| transition: background-color 0.2s; | ||
| } | ||
|
|
||
| .VPNavBarMenuLink.nav-button:hover { | ||
| background-color: var(--vp-c-brand-2); | ||
| color: #fff; | ||
|
Comment on lines
+232
to
+234
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Increase the hover-state contrast. The hover state renders white text on
|
||
| } | ||
|
|
||
| .VPNavBarMenuLink.nav-button:focus-visible { | ||
| outline: 2px solid var(--vp-c-brand-1); | ||
| outline-offset: 3px; | ||
| } | ||
|
|
||
| .VPNavBarMenuLink.nav-button.mobile-nav-single-link { | ||
| margin: 12px 0; | ||
| } | ||
| </style> | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Format the changed class binding.
The supplied ESLint result reports a Prettier error on this changed line. The repository lint script runs ESLint with
--max-warnings 0 --fix, so commit the formatted form instead of relying on validation to rewrite the file. (raw.githubusercontent.com)Proposed formatting fix
Committable suggestion
ESLint
[error] 44-44: Replace
'VPNavBarMenuLink',·{·active:·isActive,·'nav-button':·props.button·}with⏎······'VPNavBarMenuLink',⏎······{·active:·isActive,·'nav-button':·props.button·},⏎····(prettier/prettier)
Source: Linters/SAST tools