Skip to content

Commit efc75f7

Browse files
authored
feat: add dynamic hover and click effects to hero section buttons (#386)
1 parent 6c6ce61 commit efc75f7

File tree

1 file changed

+115
-9
lines changed

1 file changed

+115
-9
lines changed

src/pages/index.module.css

Lines changed: 115 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -91,34 +91,140 @@
9191

9292
/* Base styles for the buttons (scoped via CSS module) */
9393
.actionButtons .getStartedBtn {
94-
background-color: #fff;
94+
background: linear-gradient(135deg, #fff 0%, #f0eeff 100%);
9595
color: #443d80;
9696
border: 2px solid #fff;
9797
border-radius: 6px;
98+
position: relative;
99+
overflow: hidden;
100+
box-shadow: 0 4px 12px rgb(68 61 128 / 15%);
101+
}
102+
103+
/* Animated gradient shine effect for Get Started button */
104+
.actionButtons .getStartedBtn::before {
105+
content: "";
106+
position: absolute;
107+
top: -50%;
108+
left: -50%;
109+
width: 200%;
110+
height: 200%;
111+
background:
112+
linear-gradient(
113+
45deg,
114+
transparent 30%,
115+
rgb(255 255 255 / 60%) 50%,
116+
transparent 70%
117+
);
118+
transform: translateX(-100%) translateY(-100%) rotate(45deg);
119+
transition: transform 0.6s ease;
120+
}
121+
122+
.actionButtons .getStartedBtn:hover::before {
123+
transform: translateX(100%) translateY(100%) rotate(45deg);
98124
}
99125

100126
.actionButtons .tryEditorBtn {
101127
background-color: transparent;
102128
color: #fff;
103129
border: 2px solid #fff;
104130
border-radius: 6px;
131+
position: relative;
132+
overflow: hidden;
133+
box-shadow: 0 4px 12px rgb(255 255 255 / 10%);
134+
}
135+
136+
/* Animated border gradient for Try Online Editor button */
137+
.actionButtons .tryEditorBtn::before {
138+
content: "";
139+
position: absolute;
140+
inset: 0;
141+
border-radius: inherit;
142+
padding: 2px;
143+
background: linear-gradient(90deg, #a855f7, #ec4899, #f97316, #a855f7);
144+
background-size: 200% 100%;
145+
mask-composite: xor;
146+
mask-image: linear-gradient(#fff 0 0), linear-gradient(#fff 0 0);
147+
mask-clip: content-box, border-box;
148+
mask-composite: exclude;
149+
opacity: 0;
150+
transition: opacity 0.3s ease;
151+
animation: border-gradient-shift 3s linear infinite;
152+
animation-play-state: paused;
153+
}
154+
155+
@keyframes border-gradient-shift {
156+
0% {
157+
background-position: 0% 0%;
158+
}
159+
160+
100% {
161+
background-position: 200% 0%;
162+
}
163+
}
164+
165+
.actionButtons .tryEditorBtn:hover::before {
166+
opacity: 1;
167+
animation-play-state: running;
105168
}
106169

107-
/* Toned-down hover: subtle lift + faint background change for Get Started */
170+
/* Enhanced hover effects for Get Started button */
108171
.actionButtons .getStartedBtn:hover {
109-
background-color: #f6f5fb; /* very light purple tint */
172+
background: linear-gradient(135deg, #fff 0%, #e6e0ff 100%);
110173
color: #443d80;
111174
border-color: #e9e6fb;
112-
transform: translateY(-1px);
113-
box-shadow: 0 6px 18px rgb(68 61 128 / 12%) !important;
175+
transform: translateY(-2px) scale(1.02);
176+
box-shadow: 0 8px 24px rgb(68 61 128 / 20%) !important;
114177
}
115178

116-
/* Slightly toned hover for Try Online Editor */
179+
/* Enhanced hover effect for Try Online Editor button */
117180
.actionButtons .tryEditorBtn:hover {
118-
background-color: transparent;
181+
background-color: rgb(168 85 247 / 10%);
119182
color: #fff;
120-
border-color: #fff;
121-
transform: translateY(-1px);
183+
border-color: transparent;
184+
transform: translateY(-2px) scale(1.02);
185+
box-shadow: 0 8px 24px rgb(168 85 247 / 25%);
186+
}
187+
188+
/* Active/Click state with pulse effect for Get Started */
189+
.actionButtons .getStartedBtn:active {
190+
transform: translateY(0) scale(0.98);
191+
box-shadow: 0 2px 8px rgb(68 61 128 / 15%);
192+
animation: pulse-effect-primary 0.4s ease;
193+
}
194+
195+
/* Active/Click state with pulse effect for Try Online Editor */
196+
.actionButtons .tryEditorBtn:active {
197+
transform: translateY(0) scale(0.98);
198+
box-shadow: 0 2px 8px rgb(168 85 247 / 20%);
199+
animation: pulse-effect-secondary 0.4s ease;
200+
}
201+
202+
@keyframes pulse-effect-primary {
203+
0% {
204+
box-shadow: 0 0 0 0 rgb(68 61 128 / 40%);
205+
}
206+
207+
50% {
208+
box-shadow: 0 0 0 10px rgb(68 61 128 / 0%);
209+
}
210+
211+
100% {
212+
box-shadow: 0 0 0 0 rgb(68 61 128 / 0%);
213+
}
214+
}
215+
216+
@keyframes pulse-effect-secondary {
217+
0% {
218+
box-shadow: 0 0 0 0 rgb(168 85 247 / 40%);
219+
}
220+
221+
50% {
222+
box-shadow: 0 0 0 10px rgb(168 85 247 / 0%);
223+
}
224+
225+
100% {
226+
box-shadow: 0 0 0 0 rgb(168 85 247 / 0%);
227+
}
122228
}
123229

124230
@media screen and (max-width: 966px) {

0 commit comments

Comments
 (0)