Skip to content

Commit c32fec5

Browse files
committed
fix(docs): add github star link
1 parent fb23fba commit c32fec5

File tree

2 files changed

+132
-1
lines changed

2 files changed

+132
-1
lines changed
Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
---
2+
import { Icon } from '@astrojs/starlight/components';
3+
4+
---
5+
6+
<style>
7+
@keyframes spinner {
8+
to {
9+
transform: rotate(360deg);
10+
}
11+
}
12+
13+
@keyframes slide-down {
14+
0% {
15+
transform: translate(-50%, -140%);
16+
opacity: 0;
17+
}
18+
100% {
19+
transform: translate(-50%, 0%);
20+
opacity: 1;
21+
}
22+
}
23+
.spinner:before {
24+
content: "";
25+
box-sizing: border-box;
26+
position: absolute;
27+
top: 50%;
28+
left: 50%;
29+
width: 12px;
30+
height: 12px;
31+
margin-top: -6px;
32+
margin-left: -7px;
33+
border-radius: 50%;
34+
border: 2px solid #fff;
35+
border-top-color: #333;
36+
animation: spinner 0.6s linear infinite;
37+
}
38+
.container{
39+
position: absolute;
40+
top: 80px;
41+
left: 50%;
42+
transform: translate(-50%, 0%);
43+
background-color: transparent;
44+
drop-shadow: drop-shadow(0 20px 13px rgba(0, 0, 0, 0.03)) drop-shadow(0 8px 5px rgba(0, 0, 0, 0.08));
45+
border-radius: 20px;
46+
border: 1px solid var(--sl-color-accent-high);
47+
animation: slide-down 0.5s ease-in-out;
48+
}
49+
.link {
50+
display: flex;
51+
padding: 0.5rem;
52+
padding-left: 0.75rem;
53+
padding-right: 0.75rem;
54+
gap: 0.5rem;
55+
align-items: center;
56+
border-radius: 9999px;
57+
border-width: 1px;
58+
font-size: 0.875rem;
59+
line-height: 1.25rem;
60+
font-weight: 100;
61+
background-image: background-image: linear-gradient(to right, var(--tw-gradient-stops));
62+
transition-duration: 300ms;
63+
text-decoration: none;
64+
}
65+
.link:hover {
66+
text-decoration: none;
67+
color: var(--sl-color-accent-high);
68+
}
69+
.star-count{
70+
font-weight: 700;
71+
min-width: 20px;
72+
color: transparent;
73+
background-clip: text;
74+
background-image: background-image: linear-gradient(to bottom right, var(--tw-gradient-stops));
75+
background-color: #F59E0B;
76+
filter: drop-shadow(0 0 3rem var(--overlay-blurple));
77+
drop-shadow: drop-shadow(0 20px 13px rgba(0, 0, 0, 0.03)) drop-shadow(0 8px 5px rgba(0, 0, 0, 0.08));
78+
}
79+
80+
</style>
81+
82+
<script>
83+
document.addEventListener("DOMContentLoaded", () => {
84+
const starCountElement = document.getElementById("star-count");
85+
if (starCountElement) {
86+
starCountElement.classList.add("spinner");
87+
88+
fetch("https://api.github.com/repos/obytes/react-native-template-obytes")
89+
.then((response) => response.json())
90+
.then((data) => {
91+
starCountElement.classList.remove("spinner");
92+
const starCount = data.stargazers_count;
93+
starCountElement.textContent = starCount;
94+
})
95+
.catch((error) => {
96+
starCountElement.classList.remove("spinner");
97+
console.error("Error:", error);
98+
});
99+
}
100+
});
101+
</script>
102+
<div class="container">
103+
<a
104+
target="_blank"
105+
rel="noreferrer noopener"
106+
href="https://github.com/obytes/react-native-template-obytes"
107+
class="link">
108+
<span
109+
id="star-count"
110+
class="star-count"
111+
></span>
112+
<Icon name="star" color="goldenrod" size="1rem" />
113+
<span class="opacity-50">|</span>
114+
<span class="">Give us a star on Github</span>
115+
<svg
116+
xmlns="http://www.w3.org/2000/svg"
117+
width="16"
118+
height="16"
119+
viewBox="0 0 24 24"
120+
fill="none"
121+
stroke="currentColor"
122+
stroke-width="2"
123+
stroke-linecap="round"
124+
stroke-linejoin="round"
125+
>
126+
<path d="m9 18 6-6-6-6"></path>
127+
</svg>
128+
</a>
129+
</div>

docs/src/content/docs/index.mdx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,11 @@ hero:
1919
---
2020

2121
import { Card, CardGrid } from '@astrojs/starlight/components';
22-
22+
import GithubStar from '../../components/GithubStar.astro';
2323
import About from '../../components/about.astro';
2424

25+
<GithubStar />
26+
2527
## Features
2628

2729
<CardGrid stagger>

0 commit comments

Comments
 (0)