-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
150 additions
and
4 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { NavBar } from "./components/Nav"; | ||
|
||
export function App() { | ||
return <NavBar />; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
import { Link } from "wouter"; | ||
import { useState } from "react"; | ||
import { BsSearch } from "react-icons/bs"; | ||
import { GrTechnology } from "react-icons/gr"; | ||
|
||
export interface NavBar_Argument { | ||
onSearchClick?: () => void; | ||
} | ||
|
||
export function NavBar(arg: NavBar_Argument) { | ||
const { onSearchClick = () => console.log("clicked") } = arg; | ||
|
||
const [collapsed, setCollapsed] = useState(true); | ||
|
||
let collapsibleClassNames = "collapse navbar-collapse"; | ||
if (!collapsed) collapsibleClassNames += " show"; | ||
|
||
return ( | ||
<nav className="navbar navbar-expand-lg bg-light"> | ||
<div className="container-fluid"> | ||
<Link className="navbar-brand fw-bold" href="/"> | ||
<GrTechnology size={"2rem"} /> Techland | ||
</Link> | ||
|
||
<button | ||
type="button" | ||
className="navbar-toggler" | ||
onClick={() => setCollapsed(!collapsed)} | ||
> | ||
<span className="navbar-toggler-icon"></span> | ||
</button> | ||
|
||
<div className={collapsibleClassNames}> | ||
<ul className="navbar-nav me-auto mb-2 mb-sm-0"> | ||
<li className="nav-item"> | ||
<Link href="/products"> | ||
<a className="nav-link active" href="/"> | ||
Products | ||
</a> | ||
</Link> | ||
</li> | ||
</ul> | ||
|
||
<FakeSearch onClick={onSearchClick} /> | ||
</div> | ||
</div> | ||
</nav> | ||
); | ||
} | ||
|
||
export function FakeSearch({ onClick = () => {} }) { | ||
return ( | ||
<div className="d-flex" onClick={onClick}> | ||
<input | ||
type="search" | ||
className="form-control me-2" | ||
placeholder="Click here to search" | ||
/> | ||
<button className="btn btn-outline-success"> | ||
<BsSearch /> | ||
</button> | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,12 @@ | ||
import "./index.css"; | ||
import "bootstrap/dist/css/bootstrap.min.css"; | ||
|
||
import React from "react"; | ||
import { App } from "./App"; | ||
import ReactDOM from "react-dom/client"; | ||
import "./index.css"; | ||
|
||
ReactDOM.createRoot(document.getElementById("root") as HTMLElement).render( | ||
<React.StrictMode> | ||
<h1>HI</h1> | ||
<App /> | ||
</React.StrictMode> | ||
); |