Toggle navigation
Toggle navigation
This project
Loading...
Sign in
엄성진
/
Learn_In_Web
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
sungjin
2021-12-05 21:44:52 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
5dee7418bdb3ce620caefdd8c3f6a2928b0a2049
5dee7418
1 parent
e09d3b22
End all search feature
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
8 deletions
src/components/Header.js
src/pages/search.js
src/components/Header.js
View file @
5dee741
...
...
@@ -2,7 +2,7 @@ import {
HomeIcon
,
SearchIcon
,
UserIcon
,
Cube
Icon
,
Terminal
Icon
,
MailIcon
,
StarIcon
}
from
"@heroicons/react/outline"
...
...
@@ -17,13 +17,13 @@ function Header() {
<
header
className
=
"flex flex-col sm:flex-row m-5 mt-0 pt-5 justify-between items-center"
>
<
Link
href
=
"/"
passHref
>
<
div
className
=
"flex cursor-pointer transform hover:scale-105"
>
<
Cube
Icon
className
=
"h-20"
/>
<
Terminal
Icon
className
=
"h-20"
/>
<
p
className
=
"text-7xl font-extrabold"
>
Learn
In
Web
<
/p
>
<
/div></
Link
>
<
div
className
=
"flex flex-grow justify-evenly max-w-sm"
>
<
HeaderItem
title
=
'HOME'
Icon
=
{
HomeIcon
}
link
=
"/"
/>
<
HeaderItem
title
=
'STAR'
Icon
=
{
StarIcon
}
link
=
"/"
/>
<
HeaderItem
title
=
'SEARCH'
Icon
=
{
SearchIcon
}
link
=
"/"
/>
<
HeaderItem
title
=
'SEARCH'
Icon
=
{
SearchIcon
}
link
=
"/
search/
"
/>
<
HeaderItem
title
=
'ACCOUNT'
Icon
=
{
UserIcon
}
link
=
"/"
/>
<
Islogin
/>
<
/div
>
...
...
src/pages/search.js
View file @
5dee741
import
{
searchPost
}
from
"../api/post/post"
;
import
{
useState
}
from
"react"
;
import
{
SearchIcon
}
from
"@heroicons/react/outline"
;
export
default
function
Search
()
{
const
handleSubmit
=
async
(
e
)
=>
{
const
handleSubmit
=
async
(
e
)
=>
{
e
.
preventDefault
();
const
search
=
await
searchPost
(
e
.
target
.
search
.
value
);
console
.
log
(
search
)
...
...
@@ -12,13 +13,15 @@ export default function Search() {
const
[
result
,
setResult
]
=
useState
([]);
return
(
<
div
>
<
div
className
=
" ml-10 mr-10"
>
<
form
onSubmit
=
{
handleSubmit
}
>
<
input
name
=
"search"
id
=
"search"
placeholder
=
"Search Something..."
><
/input
>
<
button
type
=
"submit"
>
Search
<
/button
>
<
input
name
=
"search"
id
=
"search"
placeholder
=
"Search Something..."
className
=
"w-[90%] h-10 text-xl"
><
/input
>
<
button
type
=
"submit"
>
<
SearchIcon
className
=
"h-10 ml-2 -mb-3 rounded-full border-black border-2 p-1"
/>
<
/button
>
<
/form
>
<
div
>
<
h1
>
Search
Result
<
/h1
>
<
h1
className
=
"text-2xl font-bold"
>
Search
Result
<
/h1
>
{
result
.
map
((
post
)
=>
{
return
(
<
div
>
...
...
Please
register
or
login
to post a comment