Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
F
final-exam
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Nawasan Wisitsingkhon
final-exam
Commits
19c283bf
Commit
19c283bf
authored
Oct 02, 2023
by
Nawasan Wisitsingkhon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
search on AdminNavbar
parent
d93bc232
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
7 deletions
+19
-7
AdminNavbar.js
src/components/AdminNavbar.js
+19
-7
No files found.
src/components/AdminNavbar.js
View file @
19c283bf
...
...
@@ -9,21 +9,18 @@ import Typography from "@mui/material/Typography";
import
InputBase
from
"@mui/material/InputBase"
;
import
Badge
from
"@mui/material/Badge"
;
import
MenuItem
from
"@mui/material/MenuItem"
;
import
{
InsertChart
}
from
"@mui/icons-material"
;
import
Menu
from
"@mui/material/Menu"
;
import
MenuIcon
from
"@mui/icons-material/Menu"
;
import
SearchIcon
from
"@mui/icons-material/Search"
;
import
AccountCircle
from
"@mui/icons-material/AccountCircle"
;
import
ShoppingCart
from
"@mui/icons-material/ShoppingCart"
;
import
{
UserContext
}
from
"@/pages/_app"
;
import
Link
from
"next/link"
;
import
{
Favorite
}
from
"@mui/icons-material"
;
import
{
Logout
,
SupervisedUserCircle
}
from
"@mui/icons-material"
;
import
{
InsertChart
}
from
"@mui/icons-material"
;
import
{
ProductionQuantityLimits
}
from
"@mui/icons-material"
;
import
{
Inventory
}
from
"@mui/icons-material"
;
import
{
Category
}
from
"@mui/icons-material"
;
import
{
PeopleAlt
}
from
"@mui/icons-material"
;
import
{
MeetingRoom
}
from
"@mui/icons-material"
;
import
{
useRouter
}
from
"next/router"
;
const
Search
=
styled
(
"div"
)(({
theme
})
=>
({
position
:
"relative"
,
...
...
@@ -67,10 +64,18 @@ const StyledInputBase = styled(InputBase)(({ theme }) => ({
function
AdminNavbar
(
props
)
{
const
user
=
useContext
(
UserContext
);
const
router
=
useRouter
();
const
[
search
,
setSearch
]
=
React
.
useState
(
router
.
query
?.
q
??
""
);
const
{
window
}
=
props
;
const
[
anchorEl
,
setAnchorEl
]
=
React
.
useState
(
null
);
const
[
mobileMoreAnchorEl
,
setMobileMoreAnchorEl
]
=
React
.
useState
(
null
);
const
[
mobileOpen
,
setMobileOpen
]
=
React
.
useState
(
false
);
React
.
useEffect
(()
=>
{
router
.
push
({
pathname
:
router
.
pathname
,
query
:
{
q
:
search
}})
},
[
search
])
const
handleDrawerToggle
=
()
=>
{
setMobileOpen
(
!
mobileOpen
);
};
...
...
@@ -182,7 +187,7 @@ function AdminNavbar(props) {
element
:
(
<
IconButton
size
=
"large"
aria
-
label
=
"show 4 new mails"
color
=
"inherit"
>
<
Badge
color
=
"error"
>
<
MeetingRoom
/>
<
MeetingRoom
/>
<
/Badge
>
<
/IconButton
>
),
...
...
@@ -238,12 +243,19 @@ function AdminNavbar(props) {
<
StyledInputBase
placeholder
=
"Search…"
inputProps
=
{{
"aria-label"
:
"search"
}}
value
=
{
search
}
onChange
=
{(
e
)
=>
setSearch
(
e
.
target
.
value
)}
/
>
<
/Search
>
<
Box
sx
=
{{
flexGrow
:
1
}}
/
>
<
Box
sx
=
{{
display
:
{
xs
:
"none"
,
md
:
"flex"
}
}}
>
{
MenuList
.
map
((
menu
,
idx
)
=>
(
<
Link
title
=
{
menu
.
label
}
className
=
"text-white"
key
=
{
idx
}
href
=
{
menu
.
link
}
>
<
Link
title
=
{
menu
.
label
}
className
=
"text-white"
key
=
{
idx
}
href
=
{
menu
.
link
}
>
<
span
>
{
menu
.
element
}
<
/span
>
<
/Link
>
))}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment