Skip to content

Commit f26afcf

Browse files
committed
Added search component
1 parent ba94a1c commit f26afcf

File tree

3 files changed

+64
-0
lines changed

3 files changed

+64
-0
lines changed

LinkDotNet.Blog.Web/Shared/NavMenu.razor

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@
1818
<li><a target="_blank" href="@_configuration.GithubAccountUrl"><i class="fab fa-github"></i> Github</a></li>
1919
}
2020
<AccessControl></AccessControl>
21+
<li>
22+
<SearchInput></SearchInput>
23+
</li>
2124
</ul>
2225
</div>
2326
</div>
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<div class="search-bar">
2+
<input type="text" class="search-bar-input" placeholder="search" aria-label="search"/>
3+
<button class="search-bar-button" aria-label="search submit"><i class="fas fa-search"></i></button>
4+
</div>
5+
6+
@code {
7+
[Parameter]
8+
public string Value { get; set; }
9+
}
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
.search-bar {
2+
border: 2px solid white;
3+
display: flex;
4+
border-radius: 100vh;
5+
overflow: hidden;
6+
height: 45px;
7+
padding: 3px;
8+
width: 45px;
9+
position: relative;
10+
transition: width 300ms ease-in-out;
11+
}
12+
13+
.search-bar-input {
14+
flex-grow: 1;
15+
padding: 0 .5em;
16+
border: 0;
17+
opacity: 0;
18+
background: transparent;
19+
position: absolute;
20+
top: 0;
21+
bottom: 0;
22+
left: 0;
23+
z-index: 2;
24+
cursor: pointer;
25+
color:white;
26+
}
27+
28+
.search-bar-input:focus {
29+
outline: 0;
30+
}
31+
32+
.search-bar-button {
33+
color: white;
34+
border: 0;
35+
border-radius: 100vh;
36+
margin-left: auto;
37+
width: calc(45px - 10px);
38+
height: calc(45px - 10px);
39+
cursor: pointer;
40+
background: transparent;
41+
}
42+
43+
.search-bar:focus-within {
44+
width: 170px;
45+
}
46+
47+
.search-bar:focus-within .search-bar-input {
48+
cursor: initial;
49+
opacity: 1;
50+
z-index: initial;
51+
max-width: 130px;
52+
}

0 commit comments

Comments
 (0)