-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
78ca6da
commit 9dbff69
Showing
2 changed files
with
40 additions
and
18 deletions.
There are no files selected for viewing
38 changes: 38 additions & 0 deletions
38
packages/starlight-plugin-show-latest-version/components/VersionBadge.astro
This file contains 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 |
---|---|---|
@@ -0,0 +1,38 @@ | ||
--- | ||
--- | ||
|
||
<div id="starlight-plugin-show-latest-version"></div> | ||
|
||
<script> | ||
import fetchVersion from '../libs/utils'; | ||
import pluginConfig from 'virtual:starlight-plugin-show-latest-version-config'; | ||
|
||
(async () => { | ||
let version = await fetchVersion(pluginConfig); | ||
|
||
const container = document.querySelector('#starlight-plugin-show-latest-version'); | ||
|
||
if (version.versionAvailable) { | ||
console.log("got version"); | ||
if (container) { | ||
container.innerHTML = ` | ||
<a href="https://github.com/${pluginConfig.repo}/releases" id="starlight-plugin-show-latest-version-link"> | ||
<Badge text="${version.version}" size="${pluginConfig.badge.size}" variant="${pluginConfig.badge.variant}" /> | ||
</a> | ||
`; | ||
} | ||
} | ||
})(); | ||
</script> | ||
|
||
<style> | ||
#starlight-plugin-show-latest-version-link { | ||
display: none; | ||
align-items: center; | ||
text-decoration: none; | ||
} | ||
|
||
.visible { | ||
display: flex !important; | ||
} | ||
</style> |
This file contains 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