Skip to content

Commit

Permalink
Merge pull request #48 from danial117/client_dev_26
Browse files Browse the repository at this point in the history
initla commit
  • Loading branch information
danial117 authored Sep 21, 2024
2 parents e6259f5 + 20d1ef9 commit e43b387
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 18 deletions.
6 changes: 3 additions & 3 deletions src/components/MainPageProducts.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ const MainPageProducts=()=>{
const RequestProducts=async()=>{


await fetch(`${process.env.REACT_APP_API_URL}/products?page=${page}&limit=6`,{
await fetch(`${process.env.REACT_APP_API_URL}/products?page=${page}&limit=28`,{
method:'GET'
}).then((response)=>response.json()).then((result)=>{products.push(...result);setPage(page+1); })

Expand All @@ -72,7 +72,7 @@ const MainPageProducts=()=>{

const FetchProduct=async()=>{

await fetch(`${process.env.REACT_APP_API_URL}/products?page=${page}&limit=6`,{
await fetch(`${process.env.REACT_APP_API_URL}/products?page=${page}&limit=40`,{
method:'GET'
}).then((response)=>response.json()).then((result)=>{setProducts(result); setPage(page+1)})

Expand Down Expand Up @@ -121,7 +121,7 @@ const MainPageProducts=()=>{
{


fetch(`${process.env.REACT_APP_API_URL}/products?type=${search}&page=${searchPage}&limit=6`,{
fetch(`${process.env.REACT_APP_API_URL}/products?type=${search}&page=${searchPage}&limit=16`,{
method:'GET'
}).then((response)=>response.json()).then((result)=>{setProducts(result); })
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/MainProductCarousal.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ const MainProductCarousal=()=>{
const FetchCarousalProduct=async()=>{


await fetch(`${process.env.REACT_APP_API_URL}/products?page=1&limit=4`,{
await fetch(`${process.env.REACT_APP_API_URL}/products?page=1&limit=16`,{
method:'GET'
}).then((response)=>response.json()).then((result)=>{setProducts(result)})

Expand Down
2 changes: 1 addition & 1 deletion src/components/SearchComponent.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const SearchComponent = ({ isMobile }) => {



await fetch(`${process.env.REACT_APP_API_URL}/products/search?product=${search.product}`, {
await fetch(`${process.env.REACT_APP_API_URL}/products/search?product=${search.product}&limit=20`, {
method: 'GET',
})
.then((response) => response.json())
Expand Down
11 changes: 7 additions & 4 deletions src/scenes/BrandPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,8 @@ const BrandPage = () => {
<div className="container w-full flex flex-col mx-auto p-4 pb-24">
<p className="font-Abel py-6 text-[1.7rem]">Results:</p>
<div className="grid w-full grid-cols-1 md:grid-cols-3 gap-6">
{isLoading ? (
<RenderSkeletons /> // Capitalized to make it a valid React component
) : (
{

typeof products === 'object' && products.map((data, index) => {
const carted = cartItemIds.includes(data._id);

Expand Down Expand Up @@ -136,7 +135,11 @@ const BrandPage = () => {
</div>
);
})
)}
}

{isLoading &&
<RenderSkeletons /> // Capitalized to make it a valid React component
}

</div>
<div onClick={refetch} className="border-2 mx-auto cursor-pointer xs:max-sm:w-[80%] sm:max-md:w-[30%] py-4 w-[20%] mt-24 border-emerald-500 rounded-md">
Expand Down
11 changes: 5 additions & 6 deletions src/scenes/ProductPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ if (foundItem) {

<TruncateText
text={product.name}
maxLength={50}
maxLength={60}
className="font-Abel text-[2rem] xs:max-md:text-[1.4rem] font-bold"
/>

Expand Down Expand Up @@ -453,12 +453,11 @@ if (foundItem) {


</div>




<SimiliarProducts />

{ product &&

<SimiliarProducts productName={product.name} category={product.category} brand={product.brand} />
}
<Footer />

{cart && <Cart/>}
Expand Down
6 changes: 3 additions & 3 deletions src/widget/SimiliarProducts.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ import { useNavigate } from 'react-router-dom';
import { TruncateText } from '../utility functions/TranctuateText';


const SimiliarProducts=()=>{

const SimiliarProducts=({productName,category,brand})=>{
const [products,setProducts]=useState([]);
const navigate=useNavigate()

useEffect(()=>{


fetch(`${process.env.REACT_APP_API_URL}/products?page=1&limit=3`,{
fetch(`${process.env.REACT_APP_API_URL}/products?name=${productName}&category=${category}&brand=${brand}&limit=6`,{
method:'GET'
}).then((response)=>response.json()).then((result)=>{setProducts(result)})

Expand Down

0 comments on commit e43b387

Please sign in to comment.