Skip to content

Commit

Permalink
improve responsiveness for mobile phone
Browse files Browse the repository at this point in the history
  • Loading branch information
DIWAKARKASHYAP committed Oct 1, 2023
1 parent cd6c677 commit b768136
Showing 1 changed file with 23 additions and 8 deletions.
31 changes: 23 additions & 8 deletions components/Nav/NavPrimaryMobile.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { useState } from "react"
import { NavItem } from "./NavItem"
import { pages } from "../../data/pages"
import styles from "./NavPrimary.module.css"
Expand All @@ -11,17 +12,31 @@ export const NavPrimaryMobile = ({
activeNavLink,
handleNavClick,
}: INavProps) => {

const [search, setSearch] = useState<string>("")

return (
<nav aria-label="Primary" className={styles.navPrimaryMobile}>
<ul className={styles.navList}>
{pages.map((page, index) => (
<NavItem
key={page.name + index}
page={page}
activeNavLink={activeNavLink}
handleNavClick={handleNavClick}
/>
))}
<input
className={styles.searchBox}
placeholder="search"
type="text"
onChange={(e) => setSearch(e.target.value.toLowerCase())}
/>
{pages.map((page, index) =>
page.name.toLowerCase().includes(search) ? (
<NavItem
key={page.name + index}
page={page}
activeNavLink={activeNavLink}
handleNavClick={handleNavClick}

/>
) : (
""
)
)}
</ul>
</nav>
)
Expand Down

0 comments on commit b768136

Please sign in to comment.