-
Notifications
You must be signed in to change notification settings - Fork 272
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
54 changed files
with
3,954 additions
and
45 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
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
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,25 @@ | ||
import React from "react"; | ||
|
||
const CategoryForm = ({ handleSubmit, value, setValue }) => { | ||
return ( | ||
<> | ||
<form onSubmit={handleSubmit}> | ||
<div className="mb-3"> | ||
<input | ||
type="text" | ||
className="form-control" | ||
placeholder="Enter new category" | ||
value={value} | ||
onChange={(e) => setValue(e.target.value)} | ||
/> | ||
</div> | ||
|
||
<button type="submit" className="btn btn-primary"> | ||
Submit | ||
</button> | ||
</form> | ||
</> | ||
); | ||
}; | ||
|
||
export default CategoryForm; |
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,40 @@ | ||
import React from "react"; | ||
import { useSearch } from "../../context/search"; | ||
import axios from "axios"; | ||
import { useNavigate } from "react-router-dom"; | ||
const SearchInput = () => { | ||
const [values, setValues] = useSearch(); | ||
const navigate = useNavigate(); | ||
|
||
const handleSubmit = async (e) => { | ||
e.preventDefault(); | ||
try { | ||
const { data } = await axios.get( | ||
`/api/v1/product/search/${values.keyword}` | ||
); | ||
setValues({ ...values, results: data }); | ||
navigate("/search"); | ||
} catch (error) { | ||
console.log(error); | ||
} | ||
}; | ||
return ( | ||
<div> | ||
<form className="d-flex" role="search" onSubmit={handleSubmit}> | ||
<input | ||
className="form-control me-2" | ||
type="search" | ||
placeholder="Search" | ||
aria-label="Search" | ||
value={values.keyword} | ||
onChange={(e) => setValues({ ...values, keyword: e.target.value })} | ||
/> | ||
<button className="btn btn-outline-success" type="submit"> | ||
Search | ||
</button> | ||
</form> | ||
</div> | ||
); | ||
}; | ||
|
||
export default SearchInput; |
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,39 @@ | ||
import React from "react"; | ||
import { NavLink } from "react-router-dom"; | ||
const AdminMenu = () => { | ||
return ( | ||
<> | ||
<div className="text-center"> | ||
<div className="list-group"> | ||
<h4>Admin Panel</h4> | ||
<NavLink | ||
to="/dashboard/admin/create-category" | ||
className="list-group-item list-group-item-action" | ||
> | ||
Create Category | ||
</NavLink> | ||
<NavLink | ||
to="/dashboard/admin/create-product" | ||
className="list-group-item list-group-item-action" | ||
> | ||
Create Product | ||
</NavLink> | ||
<NavLink | ||
to="/dashboard/admin/products" | ||
className="list-group-item list-group-item-action" | ||
> | ||
Products | ||
</NavLink> | ||
<NavLink | ||
to="/dashboard/admin/users" | ||
className="list-group-item list-group-item-action" | ||
> | ||
Users | ||
</NavLink> | ||
</div> | ||
</div> | ||
</> | ||
); | ||
}; | ||
|
||
export default AdminMenu; |
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 |
---|---|---|
@@ -1,15 +1,34 @@ | ||
import React from "react"; | ||
import Footer from "./Footer"; | ||
import Header from "./Header"; | ||
|
||
const Layout = ({ children }) => { | ||
import { Helmet } from "react-helmet"; | ||
import { Toaster } from "react-hot-toast"; | ||
const Layout = ({ children, title, description, keywords, author }) => { | ||
return ( | ||
<div> | ||
<Helmet> | ||
<meta charSet="utf-8" /> | ||
<meta name="description" content={description} /> | ||
<meta name="keywords" content={keywords} /> | ||
<meta name="author" content={author} /> | ||
<title>{title}</title> | ||
</Helmet> | ||
<Header /> | ||
<main style={{ minHeight: "70vh" }}>{children}</main> | ||
<main style={{ minHeight: "70vh" }}> | ||
<Toaster /> | ||
|
||
{children} | ||
</main> | ||
<Footer /> | ||
</div> | ||
); | ||
}; | ||
|
||
Layout.defaultProps = { | ||
title: "Ecommerce app - shop now", | ||
description: "mern stack project", | ||
keywords: "mern,react,node,mongodb", | ||
author: "Techinfoyt", | ||
}; | ||
|
||
export default Layout; |
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,27 @@ | ||
import React from "react"; | ||
import { NavLink } from "react-router-dom"; | ||
const UserMenu = () => { | ||
return ( | ||
<div> | ||
<div className="text-center"> | ||
<div className="list-group"> | ||
<h4>Dashboard</h4> | ||
<NavLink | ||
to="/dashboard/user/profile" | ||
className="list-group-item list-group-item-action" | ||
> | ||
Profile | ||
</NavLink> | ||
<NavLink | ||
to="/dashboard/user/orders" | ||
className="list-group-item list-group-item-action" | ||
> | ||
Orders | ||
</NavLink> | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default UserMenu; |
Oops, something went wrong.