Skip to content

Commit 852cfb8

Browse files
Add typewriter effect for pipinstall on homepage (#8)
* Add typewriter effect for pipinstall on homepage * Fix weird conflicts
1 parent 400f996 commit 852cfb8

File tree

2 files changed

+49
-4
lines changed

2 files changed

+49
-4
lines changed

src/components/hero.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ export default function Hero() {
1212
</p>
1313
<p className={styles.frameworkgradient}>game framework</p>
1414
<p>that everyone uses</p>
15-
<code className={styles.pipinstall}>pip install pygame-ce</code>
15+
<div className={styles.pipinstallcontainer}>
16+
<p className={styles.pipinstall}>$ pip install pygame-ce</p>
17+
</div>
1618
</div>
1719
<div className={styles.showcasecontainer}>
1820
<div className={styles.showcaseimage} />

src/styles/hero.module.css

Lines changed: 46 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,29 @@
1616
font-size: 1rem;
1717
}
1818

19+
.pipinstallcontainer {
20+
width: max-content;
21+
background-color: rgb(20, 20, 20);
22+
border-radius: 0.25em;
23+
padding: 0.25em 0.5em;
24+
25+
margin-top: 0.5em;
26+
}
27+
1928
.pipinstall {
2029
font-size: 1.2rem;
21-
background-color: rgb(20, 20, 20);
22-
padding: 15px;
23-
border-radius: 10px;
30+
font-family: 'Source Code Pro', monospace;
31+
32+
overflow: hidden;
33+
white-space: nowrap;
34+
opacity: 0;
35+
36+
color: white;
37+
38+
padding-right: 0.5ch;
39+
border-right: 2px solid;
40+
41+
animation: typing 1.5s steps(35, end) 1s forwards, blinking 600ms step-end 8 forwards;
2442
}
2543

2644
.showcasecontainer {
@@ -44,6 +62,30 @@
4462
color: transparent;
4563
}
4664

65+
@keyframes blinking {
66+
from {
67+
border-color: transparent;
68+
}
69+
50% {
70+
border-color: white;
71+
}
72+
to {
73+
border-color: transparent;
74+
}
75+
}
76+
77+
@keyframes typing {
78+
from {
79+
width: 0%;
80+
opacity: 1;
81+
}
82+
83+
to {
84+
width: 100%;
85+
opacity: 1;
86+
}
87+
}
88+
4789
@media only screen and (max-width: 1500px) {
4890
.textcontainer {
4991
font-size: 3rem;
@@ -103,6 +145,7 @@
103145
border-radius: 10px;
104146
}
105147

148+
.pipinstallcontainer,
106149
.pipinstall {
107150
display: none;
108151
}

0 commit comments

Comments
 (0)