forked from SUGAM-ARORA/UniCollab
-
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.
Merge branch 'SUGAM-ARORA:main' into SUGAM-ARORA#338
- Loading branch information
Showing
5 changed files
with
179 additions
and
51 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -1,31 +1,46 @@ | ||
import React from "react"; | ||
import React, { useState } from "react"; | ||
import TopSeller from "./TopSeller"; | ||
|
||
function MainRightBottomCard() { | ||
const [visibleSellers, setVisibleSellers] = useState(3); | ||
const [showMore, setShowMore] = useState(false); | ||
|
||
const handleViewMore = () => { | ||
if (showMore) { | ||
setVisibleSellers(3); | ||
} else { | ||
setVisibleSellers(TopSeller.length); | ||
} | ||
setShowMore(!showMore); | ||
}; | ||
|
||
return ( | ||
<div className="bottom_card"> | ||
<div className="bottomCard_name"> | ||
<h2>Top Contributor</h2> | ||
<a href="#">View More</a> | ||
<a href="#" onClick={handleViewMore}> | ||
{showMore ? "View Less" : "View More"} | ||
</a> | ||
</div> | ||
{TopSeller && | ||
TopSeller.map((seller) => ( | ||
<div className="topSeller fromTop" key={seller.id}> | ||
<div className="topSellerImg"> | ||
<img src={seller?.imgSrc} alt="" /> | ||
</div> | ||
<div className="topSellerName"> | ||
<p> | ||
{seller?.seller_name} <span>{seller?.username}</span> | ||
</p> | ||
</div> | ||
<a href="#" className="button"> | ||
Follow | ||
</a> | ||
|
||
{TopSeller.slice(0, visibleSellers).map((seller) => ( | ||
<div className="topSeller fromTop" key={seller.id}> | ||
<div className="topSellerImg"> | ||
<img src={seller?.imgSrc} alt="" /> | ||
</div> | ||
))} | ||
<div className="topSellerName"> | ||
<p> | ||
{seller?.seller_name} <span>{seller?.username}</span> | ||
</p> | ||
</div> | ||
<a href="#" className="button"> | ||
Follow | ||
</a> | ||
</div> | ||
))} | ||
</div> | ||
); | ||
} | ||
|
||
export default MainRightBottomCard; | ||
|
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