From 422786739d1618a2e7dc21daa46599118e56b6e8 Mon Sep 17 00:00:00 2001 From: mahdi Date: Sat, 14 May 2022 10:45:01 +0430 Subject: [PATCH] update src/components/SingleProduct/ProductDesign1/index.js and data.js --- .../SingleProduct/ProductDesign1/index.js | 33 ++----------- src/components/Tooltip/Tooltip1/index.js | 49 +++++++++++++++++++ src/components/Tooltip/index.js | 25 ++++++++++ src/redux/data.js | 11 +++++ 4 files changed, 88 insertions(+), 30 deletions(-) create mode 100644 src/components/Tooltip/Tooltip1/index.js create mode 100644 src/components/Tooltip/index.js diff --git a/src/components/SingleProduct/ProductDesign1/index.js b/src/components/SingleProduct/ProductDesign1/index.js index ef2f473..0763ad8 100644 --- a/src/components/SingleProduct/ProductDesign1/index.js +++ b/src/components/SingleProduct/ProductDesign1/index.js @@ -1,9 +1,9 @@ import React, { useState } from "react"; -import ReactTooltip from "react-tooltip"; import TagDesign1 from "../../Tag/TagDesign1"; import ButtonDivTag from "../../ButtonDesign/ButtonDivTag"; import Button from "../../ButtonDesign/Button"; import StarRating from "../../Rating/StarRating1"; +import Tooptip1 from "../../Tooltip/Tooltip1"; const Design1 = ({ productHolderClassname, @@ -80,35 +80,8 @@ const Design1 = ({ {/* select Color */} {colors && ( -
- - - - - - - - +
+
)}
diff --git a/src/components/Tooltip/Tooltip1/index.js b/src/components/Tooltip/Tooltip1/index.js new file mode 100644 index 0000000..f406af3 --- /dev/null +++ b/src/components/Tooltip/Tooltip1/index.js @@ -0,0 +1,49 @@ +import React from "react"; +import ReactTooltip from "react-tooltip"; + +const Tooptip1 = ({ items, tooltipPosition, tooltipBgColor }) => { + return ( + <> + {items.map((item, index) => ( +
+ tooltip + +
+ ))} + + ); +}; + +export default Tooptip1; + +Tooptip1.defaultProps = { + tooltipPosition: "top", + tooltipBgColor: "dark", + items: [ + { + image: "images/SingleProductyellowDotIcon.svg", + dataTip: "زرد", + }, + { + image: "images/SingleProductredDotIcon.svg", + dataTip: "قرمز", + }, + { + image: "images/SingleProductpurpleDotIcon.svg", + dataTip: "بنفش", + }, + { + image: "images/SingleProductlightBlueDotIcon.svg", + dataTip: "آبی", + }, + ], +}; diff --git a/src/components/Tooltip/index.js b/src/components/Tooltip/index.js new file mode 100644 index 0000000..e53cb87 --- /dev/null +++ b/src/components/Tooltip/index.js @@ -0,0 +1,25 @@ +import React, { useState } from "react"; + +import Tooltip1 from "./Tooltip1"; + +function Tooltip() { + const list = { + 1: , + }; + const [type, setType] = useState(1); + return ( +
+ + {list[type]} +
+ ); +} + +export default Tooltip; diff --git a/src/redux/data.js b/src/redux/data.js index 329bf6b..e7e26fa 100644 --- a/src/redux/data.js +++ b/src/redux/data.js @@ -24,6 +24,7 @@ import SwitchDesign from "../components/SwitchDesign"; import Sidebar from "../components/Sidebar"; import SingleProduct from "../components/SingleProduct"; import Rating from "../components/Rating"; +import Tooltip from "../components/Tooltip"; // mini components import MiniComponents from "../components/MiniComponents"; @@ -577,6 +578,16 @@ const components = [ code: null, }, }, + { + name: "Tooltip", + author: "Andalib", + props: [], + content: { + name: "Tooltip", + component: , + code: null, + }, + }, // mini components { name: "Mini Components",