update src/components/Blog/design2/index.js, src/components/SingleProduct/ProductDesign1/index.js and src/components/Tag/index.js

master
mahdi andalib 3 years ago
parent 8d0b11487c
commit b1f39c05ab
  1. 4
      src/components/Blog/design2/index.js
  2. 110
      src/components/SingleProduct/ProductDesign1/index.js
  3. 4
      src/components/Tag/index.js

@ -1,7 +1,7 @@
import React from "react"; import React from "react";
import Button from "../../ButtonDesign/Button"; import Button from "../../ButtonDesign/Button";
import CommentIcon from "../../MiniComponents/CommentIcon"; import CommentIcon from "../../MiniComponents/CommentIcon";
import NewTagDesign from "../../NewTagDesign"; import TagDesign1 from "../../Tag/TagDesign1";
const BlogDesign2 = ({ const BlogDesign2 = ({
blogTitle, blogTitle,
@ -34,7 +34,7 @@ const BlogDesign2 = ({
/> />
)} )}
{tagButton && ( {tagButton && (
<NewTagDesign <TagDesign1
title={"تگ"} title={"تگ"}
icon={false} icon={false}
tagClassName={ tagClassName={

@ -1,14 +1,17 @@
import React, { useState } from "react"; import React, { useState } from "react";
import ReactTooltip from "react-tooltip"; import ReactTooltip from "react-tooltip";
import TagDesign1 from "../Tag/TagDesign1"; import TagDesign1 from "../../Tag/TagDesign1";
import ButtonDivTag from "../../ButtonDesign/ButtonDivTag";
import Button from "../../ButtonDesign/Button";
import StarRating from "../../Rating/StarRating1"; import StarRating from "../../Rating/StarRating1";
const Design1 = ({ const Design1 = ({
colors, productHolderClassname,
discountPricePercent,
likeBtn, likeBtn,
discount, discount,
discountPricePercent,
colors,
discountPrice, discountPrice,
productContent, productContent,
star, star,
@ -16,8 +19,6 @@ const Design1 = ({
priceDirection, priceDirection,
productTitleAlignment, productTitleAlignment,
priceHolder, priceHolder,
productHolderBorder,
productHolderBorderColor,
productTitleColor, productTitleColor,
productExcerptTextColor, productExcerptTextColor,
productCat, productCat,
@ -28,59 +29,52 @@ const Design1 = ({
rangeWidth, rangeWidth,
addToCartHolder, addToCartHolder,
}) => { }) => {
const [isHovering, setIsHovering] = useState(false);
return ( return (
<div className="flex flex-wrap sm:flex-nowrap justify-around"> <div className={`w-fit ${productHolderClassname}`}>
<div className="w-full flex flex-wrap items-center justify-around my-10 px-4">
<div
className={`w-full sm:w-60 md:w-72 mx-1 rounded-lg shadow-sm p-2 my-3 ${productHolderBorder} ${productHolderBorderColor}`}
>
{/* product image */} {/* product image */}
<div className="w-full relative"> <div className="w-full relative">
{/* icons on image */} {/* icons on image */}
<div className="absolute left-2 top-2"> <div className="flex flex-col gap-y-2 absolute left-2 top-2">
{discountPricePercent && ( {discountPricePercent && (
<div className="bg-discountPriceBg rounded-md px-2"> <ButtonDivTag
<p className="text-discountPriceTitle font-bold text-xs"> icon={false}
23<span>%</span> text={discountPricePercent + "%"}
</p> className="p-2 bg-[#4ACA5322] text-xs text-[#4ACA53] font-sansbold rounded-md"
</div> />
)} )}
{likeBtn && ( {likeBtn && (
<div className="bg-likeBtnBg rounded-md flex justify-center my-2"> <Button
<img className={"p-2 bg-[#FFF3F3] rounded"}
src="images/SingleProductvuesax-linear-heart.svg" text={false}
alt="" icon={"images/SingleProductvuesax-linear-heart.svg"}
className="w-5" iconHolderClassName={""}
iconClassName={"w-5"}
/> />
</div>
)} )}
{discount && ( {discount && (
<div className="rounded-md"> <Button
<img className={"rounded"}
src="images/SingleProductdiscount.png" text={false}
alt="" icon={"images/SingleProductdiscount.png"}
className="w-full" iconHolderClassName={""}
iconClassName={"w-10"}
/> />
</div>
)} )}
</div> </div>
{/* img */} {/* image */}
<div className="flex-shrink-0"> <div className="flex-shrink-0">
{verticalImg && ( {verticalImg && (
<img <img
src="images/SingleProductgoldon.png" src={verticalImg}
alt="" alt="product"
className="w-full rounded-lg cursor-pointer" className="w-full rounded-lg cursor-pointer"
onMouseEnter={() => setIsHovering(true)}
onMouseLeave={() => setIsHovering(false)}
/> />
)} )}
{horizontalImg && ( {horizontalImg && (
<img <img
src="images/SingleProductwatermelon.png" src={horizontalImg}
alt="" alt="product"
className="w-full rounded-lg" className="w-full rounded-lg cursor-pointer"
/> />
)} )}
</div> </div>
@ -117,13 +111,6 @@ const Design1 = ({
<ReactTooltip place="top" type="dark" effect="float" /> <ReactTooltip place="top" type="dark" effect="float" />
</div> </div>
)} )}
<div
className={`bg-blueBgColor text-white rounded p-2 text-xs absolute left-1/2 bottom-7 transform -translate-x-1/2 -translate-y-1/2 ${
isHovering ? "" : "hidden"
}`}
>
<button>افزودن به سبد خرید</button>
</div>
</div> </div>
{/* product content */} {/* product content */}
<div className="px-2"> <div className="px-2">
@ -192,9 +179,9 @@ const Design1 = ({
</div> </div>
)} )}
{productTags && ( {productTags && (
<div className="mt-2 flex flex-wrap"> <div className="mt-2 flex flex-wrap gap-2">
{productTags.map((item, index) => ( {productTags.map((item, index) => (
<TagDesign1 title={item} key={index} /> <TagDesign1 icon={false} title={item} key={index} />
))} ))}
</div> </div>
)} )}
@ -207,29 +194,26 @@ const Design1 = ({
)} )}
</div> </div>
</div> </div>
</div>
</div>
); );
}; };
export default Design1; export default Design1;
// text colors i used for product title: Design1.defaultProps = {
// text-darkCrimsonTextColor productHolderClassname: "rounded-lg shadow-sm p-2 border border-[#C3C3C3]",
// text-productTitle
// text color i used for product excerpt: // three buttons on top left side of the holder
// text-productContent discountPricePercent: "23",
likeBtn: true,
discount: true,
// text color i used for product cat: // دو مدل عکس طراحی کردم که یکی عرض بیشتری دارد یکی ارتفاع
// text-darkCrimsonTextColor verticalImg: "images/SingleProductgoldon.png",
horizontalImg: false,
// "images/SingleProductwatermelon.png"
Design1.defaultProps = {
// icons on product image // icons on product image
colors: true, colors: true,
likeBtn: true,
discount: true,
discountPricePercent: true,
// product price // product price
discountPrice: true, discountPrice: true,
priceHolder: true, priceHolder: true,
@ -240,10 +224,6 @@ Design1.defaultProps = {
productCat: true, productCat: true,
rangeHolder: true, rangeHolder: true,
// دو مدل عکس طراحی کردم که یکی عرض بیشتری دارد یکی ارتفاع
verticalImg: true,
horizontalImg: false,
addToCartHolder: true, addToCartHolder: true,
productTitleColor: "text-productTitle", productTitleColor: "text-productTitle",
@ -254,8 +234,6 @@ Design1.defaultProps = {
// برای درصد دادن به عرض رنج // برای درصد دادن به عرض رنج
rangeWidth: "w-44", rangeWidth: "w-44",
//دی ای وی که محصول داخلش است میتونیم بهش بوردر بدیم //دی ای وی که محصول داخلش است میتونیم بهش بوردر بدیم
productHolderBorder: "border",
productHolderBorderColor: "border-grayBorderColor",
productTitleAlignment: "text-justify", productTitleAlignment: "text-justify",
//میتونیم تعیین کنیم که قیمت و دکمه اضاف به سبد خرید کنار یکدیگر باشند یا زیر هم //میتونیم تعیین کنیم که قیمت و دکمه اضاف به سبد خرید کنار یکدیگر باشند یا زیر هم

@ -1,10 +1,10 @@
import React, { useState } from "react"; import React, { useState } from "react";
import Design1 from "./TagDesign1"; import TagDesign1 from "./TagDesign1";
function Tag() { function Tag() {
const list = { const list = {
1: <Design1 />, 1: <TagDesign1 />,
}; };
const [type, setType] = useState(1); const [type, setType] = useState(1);
return ( return (

Loading…
Cancel
Save