Skip to content

Commit 896e843

Browse files
authored
doc: github link animation (#340)
* doc: github link animation * fix * fix dark mode
1 parent dd55b55 commit 896e843

File tree

2 files changed

+26
-4
lines changed

2 files changed

+26
-4
lines changed

docusaurus.config.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,9 @@ const config = {
121121
{
122122
type: 'html',
123123
position: 'left',
124-
value: `<div id="github-button">
124+
value: `<div id="github-button" class="group relative">
125125
<a href='https://github.com/zenstackhq/zenstack' class="inline-flex items-center justify-center space-x-0 rounded-md text-sm ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 h-10 px-4 py-2 group bg-gray-900 hover:bg-gray-950 transition-all duration-200 ease-in-out hover:ring-2 hover:ring-offset-2 hover:ring-gray-900 hover:no-underline">
126-
<svg
126+
<svg
127127
xmlns="http://www.w3.org/2000/svg"
128128
width="24"
129129
height="24"
@@ -139,7 +139,7 @@ const config = {
139139
<path d="M9 18c-4.51 2-5-2-7-2"></path>
140140
</svg>
141141
<span id="github-text" class="text-white pr-2">Star on Github</span>
142-
<span class="flex items-center ml-2 group-hover:text-yellow-500 transition-colors duration-200 ease-in-out">
142+
<span class="flex items-center">
143143
<svg
144144
xmlns="http://www.w3.org/2000/svg"
145145
width="24"
@@ -150,7 +150,7 @@ const config = {
150150
stroke-width="2"
151151
stroke-linecap="round"
152152
stroke-linejoin="round"
153-
class=" text-yellow-500"
153+
class=" text-yellow-500 group-hover:fill-yellow-500 transition-all duration-1000 ease-in-out"
154154
>
155155
<polygon points="12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"></polygon>
156156
</svg>

src/css/custom.css

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,25 @@
4646
display: none;
4747
}
4848
}
49+
50+
#github-button::before {
51+
content: '';
52+
position: absolute;
53+
top: 0;
54+
right: -100%;
55+
bottom: 0;
56+
width: 100%;
57+
opacity: 0.1;
58+
background: var(--ifm-navbar-background-color);
59+
transition: right 0.5s;
60+
pointer-events: none;
61+
}
62+
63+
[data-theme='dark'] #github-button::before {
64+
opacity: 0.3;
65+
}
66+
67+
#github-button:hover::before {
68+
right: 0;
69+
pointer-events: mouse;
70+
}

0 commit comments

Comments
 (0)