Skip to content

Commit e2790c6

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

File tree

1 file changed

+114
-9
lines changed

1 file changed

+114
-9
lines changed

src/pages/index.module.css

Lines changed: 114 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -91,34 +91,139 @@
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-image: linear-gradient(#fff 0 0), linear-gradient(#fff 0 0);
146+
mask-clip: content-box, border-box;
147+
mask-composite: exclude;
148+
opacity: 0;
149+
transition: opacity 0.3s ease;
150+
animation: border-gradient-shift 3s linear infinite;
151+
animation-play-state: paused;
152+
}
153+
154+
@keyframes border-gradient-shift {
155+
0% {
156+
background-position: 0% 0%;
157+
}
158+
159+
100% {
160+
background-position: 200% 0%;
161+
}
105162
}
106163

107-
/* Toned-down hover: subtle lift + faint background change for Get Started */
164+
.actionButtons .tryEditorBtn:hover::before {
165+
opacity: 1;
166+
animation-play-state: running;
167+
}
168+
169+
/* Enhanced hover effects for Get Started button */
108170
.actionButtons .getStartedBtn:hover {
109-
background-color: #f6f5fb; /* very light purple tint */
171+
background: linear-gradient(135deg, #fff 0%, #e6e0ff 100%);
110172
color: #443d80;
111173
border-color: #e9e6fb;
112-
transform: translateY(-1px);
113-
box-shadow: 0 6px 18px rgb(68 61 128 / 12%) !important;
174+
transform: translateY(-2px) scale(1.02);
175+
box-shadow: 0 8px 24px rgb(68 61 128 / 20%) !important;
114176
}
115177

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

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

0 commit comments

Comments
 (0)