-
Notifications
You must be signed in to change notification settings - Fork 733
/
Copy pathSinceVersion.astro
67 lines (64 loc) · 1.73 KB
/
SinceVersion.astro
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
---
/**
* @author 39zde <[email protected]>
*/
import { Icon } from '@astrojs/starlight/components';
interface Props {
/**
* version string
* schema: x.y.z
* @example
* ```jsx
* // Valid ✅
* <SinceVersion version="2.1.0" />
* // Invalid ❌
* <SinceVersion version="v2.1.0" />
* <SinceVersion>2.1.0</SinceVersion>
* <SinceVersion version="2.1" />
* ```
*/
version: string;
/**
* The core library the documented feature belongs to, if applicapbe.
* Leave blank if not applicable and define the link manually.
*/
library?: 'tauri' | 'api' | 'rust-cli' | 'js-cli' | 'tauri-bundler' | 'wry' | 'tao';
/**
* overrides the link to release page
*
* if the `library` prop is defined, `href` defaults to:
* - `${Astro.url.origin}/release/${Astro.props.library}/v${Astro.props.version}`
*
* if the `library` prop is `undefined`, `href` defaults to:
* - defaults to `${Astro.url.origin}/release/tauri/v${Astro.props.version}`
*/
href?: string;
}
---
<a
class="not-content"
href={Astro.props.href
? Astro.props.href
: Astro.props.library
? `${Astro.url.origin}/release/${Astro.props.library}/v${Astro.props.version}`
: `${Astro.url.origin}/release/tauri/v${Astro.props.version}`}
target="_blank"
>
<Icon name="seti:clock" />Since <code>{Astro.props.version}</code>
</a>
<style>
a {
display: inline-flex;
justify-content: center;
align-items: center;
gap: 6px;
border-radius: 0.5rem;
padding: 2px 12px 2px 12px;
font-size: small;
box-shadow: var(--sl-shadow-md);
background-color: var(--sl-color-bg-inline-code);
margin: 0 0 12px 0;
color: var(--sl-color-gray-1) !important;
text-decoration: none;
}
</style>