Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nav cards styling done #16

Open
wants to merge 68 commits into
base: day02
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
8ac1a96
Merge pull request #2 from SurabhiMoond/day01
SurabhiMoond Jun 26, 2024
642a65d
Merge pull request #14 from SurabhiMoond/day02
SurabhiMoond Jun 27, 2024
f851b3f
Merge pull request #15 from SurabhiMoond/day02
SurabhiMoond Jun 27, 2024
5d63863
Merge pull request #17 from SurabhiMoond/day02
SurabhiMoond Jun 28, 2024
7634677
Working on Search Functionality
SurabhiMoond Jun 28, 2024
233a05d
Work on Search Functionality
SurabhiMoond Jun 28, 2024
6133bbe
Merge pull request #18 from SurabhiMoond/day03
SurabhiMoond Jun 28, 2024
6598aa0
Add_To_Cart_&_Remove functionality done Dashboard Done
SurabhiMoond Jun 30, 2024
e926a89
cart&Dashboard done
SurabhiMoond Jun 30, 2024
245ab70
Merge pull request #19 from SurabhiMoond/day03
SurabhiMoond Jun 30, 2024
bc6ab21
Merge pull request #20 from SurabhiMoond/day04
SurabhiMoond Jun 30, 2024
238eb3c
sorting&Footer_Done All tasks
SurabhiMoond Jul 1, 2024
547112d
Merge pull request #21 from SurabhiMoond/day05
SurabhiMoond Jul 1, 2024
a513ca8
Update README.md
SurabhiMoond Jul 1, 2024
a997074
Update README.md
SurabhiMoond Jul 1, 2024
8f9a11b
Update README.md
SurabhiMoond Jul 1, 2024
8092845
Update README.md
SurabhiMoond Jul 1, 2024
bc819cc
Update README.md
SurabhiMoond Jul 1, 2024
00b3034
Update README.md
SurabhiMoond Jul 1, 2024
489cc49
Update README.md
SurabhiMoond Jul 1, 2024
f534358
Update README.md
SurabhiMoond Jul 1, 2024
d53d565
Update README.md
SurabhiMoond Jul 1, 2024
82f5249
Update README.md
SurabhiMoond Jul 1, 2024
7f87417
dataCreated
SurabhiMoond Jul 2, 2024
89e34ca
Merge pull request #22 from SurabhiMoond/dataMama
SurabhiMoond Jul 2, 2024
5a407de
data
SurabhiMoond Jul 2, 2024
1e1080a
Update package.json
SurabhiMoond Jul 2, 2024
57de043
Update package.json
SurabhiMoond Jul 2, 2024
8042fd2
Update package.json
SurabhiMoond Jul 2, 2024
5d7d5ca
Merge branch 'main' into dataMama
SurabhiMoond Jul 2, 2024
2aa0271
Merge pull request #23 from SurabhiMoond/dataMama
SurabhiMoond Jul 2, 2024
6758b52
Update package.json
SurabhiMoond Jul 2, 2024
5ea3a58
Update package.json
SurabhiMoond Jul 2, 2024
e2b5a88
dataModifiy
SurabhiMoond Jul 2, 2024
2aa55e1
Merge pull request #24 from SurabhiMoond/apiData
SurabhiMoond Jul 2, 2024
3df3fff
Update package.json
SurabhiMoond Jul 2, 2024
6497988
Fix start script to avoid permission issues
SurabhiMoond Jul 2, 2024
d4883a9
Merge pull request #25 from SurabhiMoond/apiData
SurabhiMoond Jul 2, 2024
b740c11
Update package.json
SurabhiMoond Jul 2, 2024
eb969fa
Update package.json
SurabhiMoond Jul 2, 2024
0d545ef
Update package.json
SurabhiMoond Jul 2, 2024
8afb4af
Update package.json
SurabhiMoond Jul 2, 2024
3a5b1a6
Update package.json
SurabhiMoond Jul 2, 2024
1606377
Update index.js
SurabhiMoond Jul 2, 2024
aee9a45
apiFolder
SurabhiMoond Jul 2, 2024
9913112
all the package install
SurabhiMoond Jul 2, 2024
0796b73
resolveIssue
SurabhiMoond Jul 2, 2024
5d13a5a
Update package.json
SurabhiMoond Jul 2, 2024
eb0cb85
Update index.js
SurabhiMoond Jul 2, 2024
1f06607
Update package.json
SurabhiMoond Jul 2, 2024
522e0e8
Update package-lock.json
SurabhiMoond Jul 2, 2024
3117414
Update package-lock.json
SurabhiMoond Jul 2, 2024
2fea899
Update package.json
SurabhiMoond Jul 2, 2024
ac0cc96
Update index.js
SurabhiMoond Jul 2, 2024
9704a84
Update jsonUrls.js
SurabhiMoond Jul 2, 2024
111ff08
Update dashboard.jsx
SurabhiMoond Jul 2, 2024
abd9bee
Update jsonUrls.js
SurabhiMoond Jul 2, 2024
00018e2
envCreate
SurabhiMoond Jul 7, 2024
b797028
url
SurabhiMoond Jul 7, 2024
1513b12
Update index.html
SurabhiMoond Sep 14, 2024
32026b6
Update index.html
SurabhiMoond Sep 14, 2024
7af9648
Update index.html
SurabhiMoond Sep 14, 2024
fa0ee8c
Update index.html
SurabhiMoond Sep 14, 2024
b31ad30
Update index.html
SurabhiMoond Sep 14, 2024
c3f63d0
Update index.html
SurabhiMoond Sep 14, 2024
a898933
Update README.md
SurabhiMoond Sep 24, 2024
1a17819
Update README.md
SurabhiMoond Sep 24, 2024
f553f96
Update README.md
SurabhiMoond Sep 24, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Work on Search Functionality
  • Loading branch information
SurabhiMoond committed Jun 28, 2024
commit 233a05d50eaa896cb5dfa01aa0006bfe22aeadac
106 changes: 92 additions & 14 deletions API/db.json

Large diffs are not rendered by default.

30 changes: 30 additions & 0 deletions mamaEarth/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions mamaEarth/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@
"@emotion/react": "^11.11.4",
"@emotion/styled": "^11.11.5",
"axios": "^1.7.2",
"chart.js": "^4.4.3",
"framer-motion": "^4.1.17",
"react": "^18.3.1",
"react-chartjs-2": "^5.2.0",
"react-dom": "^18.3.1",
"react-icons": "^5.2.1",
"react-router": "^6.24.0",
Expand Down
28 changes: 16 additions & 12 deletions mamaEarth/src/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -98,26 +98,30 @@ border-right: 1px solid rgb(235, 235, 235);
border:1px solid #00aeef;
}
/*---------DashBoard----------------*/

.dashboard {
.dashboard-container {
display: flex;
height: 100vh;
flex-direction: column;
align-items: center;
width: 80%;
margin: 20px auto;
}

.sidebar {
width: 250px;
background-color: #f0f0f0;
padding: 20px;
.product-table {
margin-top: 20px;
}

.category-stats {
display: flex;
}

.main-content {
flex-grow: 1;
.stats-table,
.stats-chart {
flex: 1;
padding: 20px;
}

.user-management, .product-management, .order-management, .reports-analytics {
max-width: 800px;
margin: 0 auto;
.stats-chart canvas {
max-height: 300px; /* Adjust as needed */
}

@media (max-width: 600px) {
Expand Down
7 changes: 5 additions & 2 deletions mamaEarth/src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import "./App.css";
import { CgProfile } from "react-icons/cg";
import { SearchBar } from "./component/SearchBar";
import { AllRoutes } from "./allRoutes/AllRoutes";
import { SearchProvider } from "./context/searchContext";
function App() {
return (
<>
Expand All @@ -13,8 +14,10 @@ function App() {
<CgProfile />
</Link>
</div>
<SearchBar />
<AllRoutes />
<SearchProvider>
<SearchBar />
<AllRoutes />
</SearchProvider>
</>
);
}
Expand Down
2 changes: 1 addition & 1 deletion mamaEarth/src/allJsonUrl/jsonUrls.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export const jsonUrls = {
products: "http://localhost:3000/products",
roles:"http://localhost:3000/products"
roles:"http://localhost:3000/roles"
};
4 changes: 4 additions & 0 deletions mamaEarth/src/allRoutes/AllRoutes.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,21 @@ import { NewLaunch } from "../pages/NewLaunch";
import { StoreLocator } from "../pages/StoreLocator";
import { Login } from "../pages/Login";
import { Signup } from "../pages/SignUp";
import { Dashboard } from "../dashboard/dashboard";
import { FaceNewL } from "../pages/FaceNewL";

export const AllRoutes = () => {
const allRouts = [
{ to: "/", element: <Home /> },
{ to: "/face", element: <Face /> },
{ to: "/face-new-launch", element: <FaceNewL/>},
{ to: "/hair", element: <Hair /> },
{ to: "/makeup", element: <Makeup /> },
{ to: "/body", element: <Body /> },
{ to: "/combo", element: <Combo /> },
{ to: "/newlaunch", element: <NewLaunch /> },
{ to: "/login", element: <Login /> },
{ to: "/dash", element: <Dashboard /> },
{ to: "/sign", element: <Signup /> },
{
to: "/storelocator",
Expand Down
10 changes: 5 additions & 5 deletions mamaEarth/src/component/NavIteam.jsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import { useState } from "react";
import { NavLink} from "react-router-dom";
import { Link, NavLink} from "react-router-dom";
import { useFetchData } from "../customHook/useFatchData";
import { jsonUrls } from "../allJsonUrl/jsonUrls";


export const NavIteam = () => {
const [selectedOption, setSelectedOption] = useState(null);

const links = [
{ to: "/", label: "HOME"},
{ to: "/face", label: "FACE"},
Expand Down Expand Up @@ -50,7 +52,7 @@ export const NavIteam = () => {
>
Explore
</p>
<p>New Launches</p>
<Link to={'/face-new-launch'}><p>New Launches</p></Link>
<p>Best Sellers</p>
<p>Gift Packs</p>
</div>
Expand Down Expand Up @@ -184,8 +186,6 @@ export const NavIteam = () => {
))}
</div>
</div>


</>
);
};
9 changes: 9 additions & 0 deletions mamaEarth/src/component/SearchBar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,17 @@ import { LiaSearchSolid } from "react-icons/lia";
import { NavIteam } from "./NavIteam";
import { Login } from "../pages/Login";
import { Link } from "react-router-dom";
import { SearchContext } from "../context/searchContext";
export const SearchBar = () => {
const { searchTerm, setSearchTerm,handleSearch } = useContext(SearchContext);

const handleSearchChange = (e) => {
setSearchTerm(e.target.value);
};

const handleSearchSubmit = () => {
handleSearch(searchTerm, products);
};
return (
<div className="header">
<div className="searchBar-main-div">
Expand Down Expand Up @@ -42,6 +49,7 @@ export const SearchBar = () => {
<input
style={{ width: "500px", fontSize: "19px" }}
type="text"
value={searchTerm}
id="searchBar-input"
placeholder="Search.................."
onChange={handleSearchChange}
Expand All @@ -50,6 +58,7 @@ export const SearchBar = () => {
<button
id="searchBtn"
className="allBtn"
onClick={handleSearchSubmit}
style={{
width: "140px",
padding: "8px",
Expand Down
24 changes: 24 additions & 0 deletions mamaEarth/src/context/searchContext.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { createContext, useState } from "react";

export const SearchContext = createContext();

export const SearchProvider = ({ children }) => {
const [searchTerm, setSearchTerm] = useState("");
const [searchResults, setSearchResults] = useState([]);

const handleSearch = (searchValue, allProducts) => {
setSearchTerm(searchValue);
const filteredResults = allProducts.filter((product) =>
product.name.toLowerCase().includes(searchValue.toLowerCase())
);
setSearchResults(filteredResults);
};

return (
<SearchContext.Provider
value={{ searchTerm, setSearchTerm, handleSearch, searchResults }}
>
{children}
</SearchContext.Provider>
);
};
12 changes: 5 additions & 7 deletions mamaEarth/src/pages/Body.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,10 @@ import { useFetchData } from "../customHook/useFatchData";
import { jsonUrls } from "../allJsonUrl/jsonUrls";

export const Body = () => {
const {
data: products,
loading,
error,
} = useFetchData(jsonUrls.products);

const { data: products, loading, error } = useFetchData(jsonUrls.products);
const bodyProducts = products.filter(
(product) => product.category === "Body"
);
if (loading) {
return (
<Flex justifyContent="center" alignItems="center" height="100vh">
Expand Down Expand Up @@ -36,7 +34,7 @@ export const Body = () => {
return (
<div>
<Grid templateColumns="repeat(4, 1fr)" gap="30px" p="30px">
{products.map((product, index) => (
{bodyProducts.map((product, index) => (
<Box key={index} className="product-card">
<img
src={product.image}
Expand Down
45 changes: 41 additions & 4 deletions mamaEarth/src/pages/Combo.jsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,46 @@
import React from 'react'
import { useFetchData } from "../customHook/useFatchData";
import { jsonUrls } from "../allJsonUrl/jsonUrls";
import { Box, Flex, Grid } from "@chakra-ui/react";

export const Combo = () => {
const { data, loading, error } = useFetchData(jsonUrls.products);
const comboProducts = data.filter((product) => product.category === "Combo");
if (loading) {
return (
<Flex justifyContent="center" alignItems="center" height="100vh">
<p>Loading...</p>
</Flex>
);
}

if (error) {
return (
<Flex justifyContent="center" alignItems="center" height="100vh">
<p>Error: {error.message}</p>
</Flex>
);
}
if (!Array.isArray(data) || data.length === 0) {
return (
<Flex justifyContent="center" alignItems="center" height="100vh">
<p>No products found.</p>
</Flex>
);
}
return (
<div>

<Grid templateColumns="repeat(4, 1fr)" gap="30px" p="30px">
{comboProducts.map((product, index) => (
<Box key={index} className="product-card">
<img
src={product.image}
alt={product.name}
style={{ width: "100%", height: "300px" }}
/>
<h1>{product.name}</h1>
</Box>
))}
</Grid>
</div>
)
}
);
};
43 changes: 41 additions & 2 deletions mamaEarth/src/pages/Face.jsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,49 @@
import React from 'react'
import { useFetchData } from '../customHook/useFatchData'
import { jsonUrls } from '../allJsonUrl/jsonUrls'
import { Box, Flex, Grid } from '@chakra-ui/react';

export const Face = () => {
const {data,loading,error}=useFetchData(jsonUrls.products);
const faceProduct=data.filter((product)=>product.category==="Face");
if (loading) {
return (
<Flex justifyContent="center" alignItems="center" height="100vh">
<p>Loading...</p>
</Flex>
);
}

if (error) {
return (
<Flex justifyContent="center" alignItems="center" height="100vh">
<p>Error: {error.message}</p>
</Flex>
);
}
if (!Array.isArray(data) || data.length === 0) {
return (
<Flex justifyContent="center" alignItems="center" height="100vh">
<p>No products found.</p>
</Flex>
);
}

return (
<div>

<Grid templateColumns="repeat(4, 1fr)" gap="30px" p="30px">
{faceProduct.map((product, index) => (
<Box key={index} className="product-card">
<img
src={product.image}
alt={product.name}
style={{ width: "100%", height: "300px" }}
/>
<h1>{product.name}</h1>
</Box>
))}
</Grid>
</div>
)
);
}

Loading