Skip to content

Commit 78f1cb2

Browse files
committed
optimizing our app
1 parent 20d2f7c commit 78f1cb2

5 files changed

Lines changed: 35 additions & 13 deletions

File tree

App.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import Cart from "./src/components/Cart";
99
import Error from "./src/components/Error";
1010
import { createBrowserRouter, RouterProvider, Outlet } from "react-router-dom";
1111
import RestaurantMenu from "./src/components/RestaurantMenu";
12+
import Profile from "./src/components/Profile";
1213

1314
const AppLayout = () => {
1415
return (
@@ -34,6 +35,12 @@ const appRouter = createBrowserRouter([
3435
{
3536
path: "/about",
3637
element: <About />,
38+
children: [
39+
{
40+
path: "profile",
41+
element: <Profile />,
42+
},
43+
],
3744
},
3845
{
3946
path: "/contactUs",

src/components/About.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
1-
import React from 'react'
1+
import {Outlet} from "react-router-dom";
2+
import React from 'react';
23

34
const About = () => {
45
return (
6+
<>
57
<div>About</div>
8+
<Outlet />
9+
</>
10+
11+
612
)
713
}
814

src/components/Body.js

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,7 @@ import { RestaurantCards } from "../components/RestaurantCards";
33
import { useState, useEffect } from "react";
44
import { Shimmer } from "./Shimmer";
55
import { Link } from "react-router-dom";
6-
7-
const filterData = (searchText, allRestaturants) => {
8-
console.log(allRestaturants);
9-
const data = allRestaturants.filter((restaurant) => {
10-
const resName = restaurant?.data?.name
11-
?.toLowerCase()
12-
.includes(searchText.toLowerCase());
13-
return resName;
14-
});
15-
// console.log(data + " inside filter data");
16-
return data;
17-
};
6+
import { filterData } from "../utils/Helper";
187

198
// function filterData(searchText, restaurant) {
209
// const filterData = restaurant.filter((restaurants) =>

src/components/Profile.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import React from 'react'
2+
3+
const Profile = () => {
4+
return (
5+
<div>Profile</div>
6+
)
7+
}
8+
9+
export default Profile

src/utils/Helper.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
export const filterData = (searchText, allRestaturants) => {
2+
console.log(allRestaturants);
3+
const data = allRestaturants.filter((restaurant) => {
4+
const resName = restaurant?.data?.name
5+
?.toLowerCase()
6+
.includes(searchText.toLowerCase());
7+
return resName;
8+
});
9+
// console.log(data + " inside filter data");
10+
return data;
11+
};

0 commit comments

Comments
 (0)