-
-
Notifications
You must be signed in to change notification settings - Fork 146
Use built-in badge for homepage release badge #278
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
Merged
waruqi
merged 1 commit into
xmake-io:master
from
Arteiimis:feat/homepage-release-badge-built-in
Apr 11, 2026
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,7 @@ | ||
| <script setup lang="ts"> | ||
| import { computed } from 'vue' | ||
| import { useData } from 'vitepress' | ||
| import { VPBadge } from 'vitepress/theme' | ||
| import { xmakeRelease } from '../../data/xmake-release.js' | ||
|
|
||
| type HeroConfig = { | ||
|
|
@@ -46,7 +47,7 @@ const badgeTitle = computed(() => { | |
| :title="badgeTitle" | ||
| :aria-label="badgeTitle" | ||
| > | ||
| {{ releaseTag }} | ||
| <VPBadge class="small xmake-release-badge-chip" type="tip" :text="releaseTag" /> | ||
| </a> | ||
| </span> | ||
| <span v-if="hero.text" v-html="hero.text" class="text"></span> | ||
|
|
@@ -109,29 +110,23 @@ const badgeTitle = computed(() => { | |
| } | ||
|
|
||
| .xmake-release-badge { | ||
| display: inline-flex; | ||
| align-items: flex-start; | ||
| position: relative; | ||
| top: -1.9em; | ||
| margin-left: 0.04em; | ||
| padding: 0.05em 0.16em; | ||
| border-radius: 0.45em; | ||
| background: transparent; | ||
| color: var(--vp-c-brand-1); | ||
| text-decoration: underline; | ||
| text-decoration-color: transparent; | ||
| text-underline-offset: 0.16em; | ||
| top: -0.6em; | ||
| margin-left: 0.08em; | ||
| text-decoration: none; | ||
| white-space: nowrap; | ||
| font-size: 0.26em; | ||
| line-height: 1; | ||
| font-weight: 700; | ||
| letter-spacing: 0.01em; | ||
| font-variant-numeric: tabular-nums; | ||
| transition: background-color 0.2s ease, color 0.2s ease, text-decoration-color 0.2s ease; | ||
| } | ||
|
|
||
| .xmake-release-badge:hover { | ||
| background: rgba(66, 211, 146, 0.12); | ||
| color: var(--vp-c-brand-2); | ||
| text-decoration-color: currentColor; | ||
| .xmake-release-badge-chip { | ||
| margin-left: 0; | ||
| transform: none; | ||
| transition: filter 0.2s ease, box-shadow 0.2s ease; | ||
|
Contributor
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. |
||
| } | ||
|
|
||
| .xmake-release-badge:hover .xmake-release-badge-chip { | ||
| filter: brightness(1.08); | ||
| } | ||
|
|
||
| @media (min-width: 640px) { | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
The
topoffset is defined inemunits relative to the inherited font size (which scales from32pxto56pxacross breakpoints), but theVPBadgenow has a fixed size (via thesmallclass). This causes the badge's vertical position to shift inconsistently relative to its own height as the screen size changes. Consider using a fixed offset (e.g., inpx) or setting a fixedfont-sizeon this wrapper so theemoffset remains proportional to the badge itself.