Skip to content

Commit 391c1f2

Browse files
committed
searchicon added
1 parent dad1069 commit 391c1f2

File tree

2 files changed

+48
-15
lines changed

2 files changed

+48
-15
lines changed

src/pages/ebooks/index.css

Lines changed: 38 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
/* ------------------------------
22
Root Container
33
------------------------------ */
4-
54
.ebook-container {
65
padding: 4rem 1.5rem;
76
max-width: 1280px;
@@ -33,20 +32,47 @@
3332
margin-right: auto;
3433
}
3534

36-
.ebook-search {
37-
margin-top: 1.5rem;
38-
padding: 0.9rem 1.3rem;
35+
/* ------------------------------
36+
Search Wrapper + Input
37+
------------------------------ */
38+
.ebook-search-wrapper {
39+
position: relative;
40+
display: inline-block;
3941
width: 60%;
4042
max-width: 480px;
43+
margin-top: 1.5rem;
44+
}
45+
46+
.ebook-search-wrapper .search-icon {
47+
position: absolute;
48+
left: 12px;
49+
top: 50%;
50+
transform: translateY(-50%);
51+
pointer-events: none; /* clicks go to input */
52+
font-size: 1.2rem;
53+
color: var(--ifm-color-gray-700);
54+
opacity: 0.6;
55+
}
56+
57+
.ebook-search-wrapper input.ebook-search {
58+
padding-left: 36px; /* space for the icon */
59+
width: 100%;
60+
height: 40px;
4161
border-radius: 12px;
4262
border: 1px solid var(--ifm-toc-border-color);
4363
font-size: 1rem;
4464
background-color: var(--ifm-background-color);
65+
color: var(--ifm-color-gray-900);
4566
box-shadow: var(--ifm-global-shadow-lw);
4667
transition: all 0.25s ease;
4768
}
4869

49-
.ebook-search:focus {
70+
.ebook-search-wrapper input.ebook-search::placeholder {
71+
color: var(--ifm-color-gray-700);
72+
opacity: 0.6;
73+
}
74+
75+
.ebook-search-wrapper input.ebook-search:focus {
5076
border-color: var(--ifm-color-primary);
5177
box-shadow: 0 0 0 4px rgba(0, 122, 255, 0.15);
5278
outline: none;
@@ -182,12 +208,14 @@
182208
grid-column: 1 / -1;
183209
}
184210

211+
/* ------------------------------
212+
Animations
213+
------------------------------ */
185214
@keyframes fadeIn {
186215
from {
187216
opacity: 0;
188217
transform: translateY(10px);
189218
}
190-
191219
to {
192220
opacity: 1;
193221
transform: translateY(0);
@@ -199,15 +227,17 @@
199227
opacity: 0;
200228
transform: translateY(20px);
201229
}
202-
203230
to {
204231
opacity: 1;
205232
transform: translateY(0);
206233
}
207234
}
208235

236+
/* ------------------------------
237+
Media Queries
238+
------------------------------ */
209239
@media (max-width: 768px) {
210-
.ebook-search {
240+
.ebook-search-wrapper {
211241
width: 90%;
212242
}
213243

src/pages/ebooks/index.tsx

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -79,13 +79,16 @@ export default function EbookPage(): JSX.Element {
7979
<p className="ebook-subtitle">
8080
Read high-quality ebooks on programming, tools, and development.
8181
</p>
82-
<input
83-
type="text"
84-
className="ebook-search"
85-
placeholder="Search ebooks..."
86-
value={searchTerm}
87-
onChange={(e) => setSearchTerm(e.target.value)}
88-
/>
82+
<div className="ebook-search-wrapper">
83+
<span className="search-icon">🔍</span>
84+
<input
85+
type="text"
86+
className="ebook-search"
87+
placeholder="Search ebooks..."
88+
value={searchTerm}
89+
onChange={(e) => setSearchTerm(e.target.value)}
90+
/>
91+
</div>
8992
</div>
9093

9194
{/* Grid Section */}

0 commit comments

Comments
 (0)