From 364fda294c38f305683abc1ae80e83a97d06d1c9 Mon Sep 17 00:00:00 2001 From: Nalvazhuthi Date: Wed, 26 Mar 2025 16:21:35 +0530 Subject: [PATCH] updated market place ui --- app/src/components/icons/marketPlaceIcons.tsx | 21 ++ app/src/components/ui/inputs/Search.tsx | 2 +- app/src/modules/market/AssetPreview.tsx | 95 ++++++++ app/src/modules/market/Card.tsx | 52 ++++- app/src/modules/market/CardsContainer.tsx | 144 +++++++++++- app/src/modules/market/FilterSearch.tsx | 2 +- .../components/marketPlace/marketPlace.scss | 205 +++++++++++++++++- package-lock.json | 6 - 8 files changed, 497 insertions(+), 30 deletions(-) create mode 100644 app/src/modules/market/AssetPreview.tsx delete mode 100644 package-lock.json diff --git a/app/src/components/icons/marketPlaceIcons.tsx b/app/src/components/icons/marketPlaceIcons.tsx index 9aa8619..76dedd3 100644 --- a/app/src/components/icons/marketPlaceIcons.tsx +++ b/app/src/components/icons/marketPlaceIcons.tsx @@ -130,3 +130,24 @@ export function StarsIconSmall() { ); } + +export function FiileedStarsIconSmall() { + return ( + + + + ); +} diff --git a/app/src/components/ui/inputs/Search.tsx b/app/src/components/ui/inputs/Search.tsx index fa9d28c..b6e1f19 100644 --- a/app/src/components/ui/inputs/Search.tsx +++ b/app/src/components/ui/inputs/Search.tsx @@ -36,7 +36,7 @@ const Search: React.FC = ({ }; return ( -
+
>; // Type for setter function +} + +const AssetPreview: React.FC = ({ + selectedCard, + setSelectedCard, +}) => { + // Ensure rating is a valid number between 0 and 5 + const rating = Math.max( + 0, + Math.min(5, isNaN(selectedCard.rating) ? 0 : selectedCard.rating) + ); + + console.log("selectedCard: ", selectedCard); + + // Ensure that the rating is a valid positive integer for array length + const starsArray = Array.from({ length: rating }, (_, index) => index); + + return ( +
+
+
+ +
+ +
+
+
H
+
+
HERX FACTORY
+
Follow +
+
+
+ + {/* asset details */} +
+
{selectedCard.assetName}
+
+ Lorem ipsum dolor sit amet consectetur adipisicing elit. + Doloremque nisi beatae facilis architecto quaerat delectus velit + aliquid assumenda cumque vitae! Tempore quibusdam ab natus in + minima voluptates, aliquid corrupti excepturi consectetur + distinctio sequi beatae odit autem? Distinctio ab, voluptatem + omnis quibusdam, incidunt eum ipsa aliquid enim eaque eveniet nisi + autem, accusantium vel! Laborum in iste voluptates ad! Harum eum + amet pariatur fugit laudantium dolorem maxime voluptates atque + molestiae modi inventore quidem maiores dolore numquam, natus + quisquam optio distinctio eveniet aliquam, aut eligendi laboriosam + eaque! Porro cumque cum distinctio ullam debitis, dolorum + similique! Harum cupiditate perferendis voluptatum molestiae, + fugiat quisquam assumenda! +
+
+
+ + {selectedCard.rating} +
+
{selectedCard.views} views
+
+
₹ {selectedCard.price}
+
+ + {/* buttons */} +
+
Add to cart
+
Buy now
+
+ + {/* close button */} +
setSelectedCard(null)}> + {`<-back`} +
+
+
+
+ ); +}; + +export default AssetPreview; diff --git a/app/src/modules/market/Card.tsx b/app/src/modules/market/Card.tsx index 3df2e1f..d0596a5 100644 --- a/app/src/modules/market/Card.tsx +++ b/app/src/modules/market/Card.tsx @@ -1,3 +1,4 @@ +// Card.tsx import React from "react"; import { CommentsIcon, @@ -8,24 +9,51 @@ import { } from "../../components/icons/marketPlaceIcons"; import assetImage from "../../assets/image/image.png"; -const Card: React.FC = () => { + +interface CardProps { + assetName: string; + uploadedOn: string; + price: number; + rating: number; + views: number; + onSelectCard: (cardData: { + assetName: string; + uploadedOn: string; + price: number; + rating: number; + views: number; + }) => void; +} + +const Card: React.FC = ({ + assetName, + uploadedOn, + price, + rating, + views, + onSelectCard, +}) => { + const handleCardSelect = () => { + onSelectCard({ assetName, uploadedOn, price, rating, views }); + }; + return (
- + {assetName}
-
Asset name
-
Uploaded on-12 Jan 23
+
{assetName}
+
{uploadedOn}
- 1.5k + {views}
@@ -39,17 +67,17 @@ const Card: React.FC = () => {
- - - - - + {[...Array(5)].map((_, index) => ( + + ))}
- ₹ 36,500/unit + ₹ {price}/unit
-
Buy now
+
+ Buy now +
); }; diff --git a/app/src/modules/market/CardsContainer.tsx b/app/src/modules/market/CardsContainer.tsx index 204ef6d..96a47e4 100644 --- a/app/src/modules/market/CardsContainer.tsx +++ b/app/src/modules/market/CardsContainer.tsx @@ -1,18 +1,152 @@ -import React from "react"; +import React, { useState } from "react"; import Card from "./Card"; +import AssetPreview from "./AssetPreview"; +import RenderOverlay from "../../components/templates/Overlay"; const CardsContainer: React.FC = () => { - const array = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]; + const array = [ + { + id: 1, + name: "Asset 1", + uploadedOn: "12 Jan 23", + price: 36500, + rating: 4.5, + views: 500, + }, + { + id: 2, + name: "Asset 2", + uploadedOn: "14 Jan 23", + price: 45000, + rating: 4.0, + views: 500, + }, + { + id: 3, + name: "Asset 3", + uploadedOn: "15 Jan 23", + price: 52000, + rating: 4.8, + views: 500, + }, + { + id: 4, + name: "Asset 4", + uploadedOn: "18 Jan 23", + price: 37000, + rating: 3.9, + views: 500, + }, + { + id: 5, + name: "Asset 5", + uploadedOn: "20 Jan 23", + price: 60000, + rating: 5.0, + views: 500, + }, + { + id: 6, + name: "Asset 6", + uploadedOn: "22 Jan 23", + price: 46000, + rating: 4.2, + views: 500, + }, + { + id: 7, + name: "Asset 7", + uploadedOn: "25 Jan 23", + price: 38000, + rating: 4.3, + views: 500, + }, + { + id: 8, + name: "Asset 8", + uploadedOn: "27 Jan 23", + price: 41000, + rating: 4.1, + views: 500, + }, + { + id: 9, + name: "Asset 9", + uploadedOn: "30 Jan 23", + price: 55000, + rating: 4.6, + views: 500, + }, + { + id: 10, + name: "Asset 10", + uploadedOn: "2 Feb 23", + price: 49000, + rating: 4.4, + views: 500, + }, + { + id: 11, + name: "Asset 11", + uploadedOn: "5 Feb 23", + price: 62000, + rating: 5.0, + views: 500, + }, + { + id: 12, + name: "Asset 12", + uploadedOn: "7 Feb 23", + price: 53000, + rating: 4.7, + views: 500, + }, + ]; + + const [selectedCard, setSelectedCard] = useState<{ + assetName: string; + uploadedOn: string; + price: number; + rating: number; + views: number; + } | null>(null); + + const handleCardSelect = (cardData: { + assetName: string; + uploadedOn: string; + price: number; + rating: number; + views: number; + }) => { + setSelectedCard(cardData); + }; + return (
Products You May Like
- {array.map((index) => ( - + {array.map((asset) => ( + ))} + {/* */} + {selectedCard && ( + + )} + {/* */}
); }; -export default CardsContainer; \ No newline at end of file +export default CardsContainer; diff --git a/app/src/modules/market/FilterSearch.tsx b/app/src/modules/market/FilterSearch.tsx index 11a2cbf..6750635 100644 --- a/app/src/modules/market/FilterSearch.tsx +++ b/app/src/modules/market/FilterSearch.tsx @@ -16,7 +16,7 @@ const FilterSearch: React.FC = () => { {}} /> diff --git a/app/src/styles/components/marketPlace/marketPlace.scss b/app/src/styles/components/marketPlace/marketPlace.scss index 3d2f647..9b2d18a 100644 --- a/app/src/styles/components/marketPlace/marketPlace.scss +++ b/app/src/styles/components/marketPlace/marketPlace.scss @@ -8,14 +8,18 @@ background-color: var(--background-color-secondary); position: absolute; left: 0; - padding: 100px 50px; + padding: 95px 8px; + padding-bottom: 32px; .marketplace-container { padding: 20px 2px; - height: calc(100vh - 120px); + // height: calc(100vh - 120px); + height: 100%; background-color: var(--background-color); box-shadow: #{$box-shadow-medium}; border-radius: #{$border-radius-extra-large}; + position: relative; + } .marketPlace { @@ -34,18 +38,23 @@ width: 100%; display: flex; align-items: center; - gap: 12px; + gap: 20px; - .search-wrapper { + .asset-search-wrapper { min-width: 60%; max-width: 684px; padding: 0; border-radius: $border-radius-large ; .search-container { + display: flex; + align-items: center; + width: 100%; border: none !important; box-shadow: $box-shadow-medium; - border-radius: $border-radius-large ; + border-radius: $border-radius-large; + overflow: hidden; + padding: 4px 12px; input { border: none !important; @@ -57,12 +66,18 @@ .regularDropdown-container { max-width: 159px; + height: 100%; + + .dropdown-header { + align-items: center; + } } .button { padding: 5px 20px; border: 1px solid var(--accent-color); border-radius: 14px; + color: var(--accent-color); } .rating-container { @@ -88,6 +103,7 @@ color: var(--text-color); font-weight: $medium-weight; font-size: $xlarge; + margin: 10px 0; } .cards-wrapper-container { @@ -116,6 +132,7 @@ border-radius: 10px; padding: 5px; background-color: var(--accent-color); + cursor: pointer; } .image-container { @@ -184,4 +201,182 @@ } } } +} + +.assetPreview-wrapper { + width: 100%; + height: 100%; + position: absolute; + top: 0; + left: 0; + + .assetPreview { + width: 100%; + height: 100%; + background-color: var(--background-color); + display: flex; + gap: 12px; + z-index: 100; + border-radius: 20px; + } + + // Image Preview Section + .image-preview { + width: 50%; + height: 100%; + + img { + width: 100%; + height: 100%; + object-fit: contain; + } + } + + // Asset Details Section + .asset-details-preview { + width: 50%; + padding: 50px 20px; + overflow-y: auto; + + } + + // Organization Section (Top part with image and details) + .organization { + display: flex; + align-items: center; + margin-bottom: 20px; + gap: 10px; + + .image { + @include flex-center; + height: 30px; + width: 30px; + min-height: 26px; + min-width: 26px; + border-radius: 50%; + font-weight: var(--font-weight-bold); + color: var(--background-color); + background-color: var(--accent-color); + } + + .organization-details { + display: flex; + flex-direction: column; + + .organization-name { + font-weight: bold; + margin-bottom: 5px; + + font-weight: #{$bold-weight}; + font-size: $regular ; + } + + .follow { + color: var(--accent-color); + cursor: pointer; + } + } + } + + // Asset Details + .asset-details { + margin-top: 20px; + + .asset-name { + font-size: 1.5em; + font-weight: bold; + margin-bottom: 10px; + font-weight: #{$bold-weight}; + font-size: $large; + } + + .asset-description { + margin-bottom: 20px; + color: #666; + } + + .asset-review { + width: fit-content; + padding: 5px 10px; + display: flex; + align-items: center; + margin-bottom: 20px; + outline: 1px solid #909090CC; + border-radius: 6px; + + .asset-rating { + display: flex; + align-items: center; + gap: 4px; + margin-right: 10px; + font-weight: bold; + position: relative; + + font-weight: #{$bold-weight}; + font-size: $regular ; + + &::after { + margin-left: 5px; + content: ""; + display: block; + width: 2px; + height: 12px; + background-color: #ccc; + + + } + } + + .asset-view { + + font-weight: #{$bold-weight}; + font-size: $regular ; + } + } + + .asset-price { + font-size: $xxlarge; + font-weight: bold; + margin-bottom: 20px; + } + } + + // Button Container and Button Styles + .button-container { + display: flex; + gap: 10px; + } + + .button { + + + color: white; + padding: 10px 20px; + border-radius: 5px; + cursor: pointer; + text-align: center; + + &:first-child { + outline: 1px solid var(--accent-color); + color: var(--accent-color); + } + + &:last-child { + background-color: var(--accent-color); + color: var(--background-color); + } + + + + } + + .closeButton { + color: var(--accent-color); + position: absolute; + top: 18px; + left: 18px; + @include flex-center; + cursor: pointer; + font-size: var(--font-size-large); + } } \ No newline at end of file diff --git a/package-lock.json b/package-lock.json deleted file mode 100644 index 5ef6c4e..0000000 --- a/package-lock.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "name": "Dwinzo_dev", - "lockfileVersion": 3, - "requires": true, - "packages": {} -}