update src/components/SingleProduct/ProductDesign1/index.js and data.js

master
mahdi 3 years ago
parent b1f39c05ab
commit 422786739d
  1. 33
      src/components/SingleProduct/ProductDesign1/index.js
  2. 49
      src/components/Tooltip/Tooltip1/index.js
  3. 25
      src/components/Tooltip/index.js
  4. 11
      src/redux/data.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 = ({
</div>
{/* select Color */}
{colors && (
<div className="flex items-center absolute right-2 bottom-2">
<img
src="images/SingleProductyellowDotIcon.svg"
alt=""
data-tip="زرد"
className="w-3 h-3 ml-1 cursor-pointer"
/>
<ReactTooltip place="top" type="dark" effect="float" />
<img
src="images/SingleProductredDotIcon.svg"
alt=""
data-tip="قرمز"
className="w-3 h-3 ml-1 cursor-pointer"
/>
<ReactTooltip place="top" type="dark" effect="float" />
<img
src="images/SingleProductpurpleDotIcon.svg"
alt=""
data-tip="بنفش"
className="w-3 h-3 ml-1 cursor-pointer"
/>
<ReactTooltip place="top" type="dark" effect="float" />
<img
src="images/SingleProductlightBlueDotIcon.svg"
alt=""
data-tip="آبی"
className="w-3 h-3 ml-1 cursor-pointer"
/>
<ReactTooltip place="top" type="dark" effect="float" />
<div className="flex items-center gap-x-1 absolute right-2 bottom-2">
<Tooptip1 />
</div>
)}
</div>

@ -0,0 +1,49 @@
import React from "react";
import ReactTooltip from "react-tooltip";
const Tooptip1 = ({ items, tooltipPosition, tooltipBgColor }) => {
return (
<>
{items.map((item, index) => (
<div className="" key={index}>
<img
src={item.image}
data-tip={item.dataTip}
alt="tooltip"
className="cursor-pointer"
/>
<ReactTooltip
place={`${tooltipPosition}`}
type={`${tooltipBgColor}`}
effect="float"
/>
</div>
))}
</>
);
};
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: "آبی",
},
],
};

@ -0,0 +1,25 @@
import React, { useState } from "react";
import Tooltip1 from "./Tooltip1";
function Tooltip() {
const list = {
1: <Tooltip1 />,
};
const [type, setType] = useState(1);
return (
<div className="w-full flex flex-col items-center">
<select
className="mb-10 w-20 bg-gray-200"
onChange={(e) => setType(e.target.value)}
>
{Object.keys(list).map((option, index) => (
<option key={index}>{option}</option>
))}
</select>
{list[type]}
</div>
);
}
export default Tooltip;

@ -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: <Tooltip />,
code: null,
},
},
// mini components
{
name: "Mini Components",

Loading…
Cancel
Save