update src/components/Feedback/index.js and data.js

master
mahdi 3 years ago
parent 79d627ed47
commit 309fd43565
  1. 39
      src/components/Feedback/index.js
  2. 11
      src/redux/data.js

@ -1,36 +1,27 @@
import React, { useState } from "react"; import React, { useState } from "react";
import removeCard from "./card-remove.svg"; const Feedback = ({ feedbakTitle, feedbacks }) => {
import sadEmoji from "./sad-emoji.svg";
import smileEmoji from "./smile-emoji.svg";
import speechlessEmoji from "./speechless-emoji.svg";
import suspiciousEmoji from "./suspicious-emoji.svg";
import heartEmoji from "./heart-emoji.svg";
import upwardArrow from "./gray-upward-icon.svg";
const Feedback = ({ feedbacks }) => {
const [closeModal, setCloseModal] = useState(false); const [closeModal, setCloseModal] = useState(false);
const [activeFeedback, setActiveFeedback] = useState(null); const [activeFeedback, setActiveFeedback] = useState(null);
return ( return (
<sections <sections
className="w-full lg:w-1/3 bg-white rounded shadow-sm border border-gray-500 mx-auto my-20 flex-col items-center justify-center relative px-4" className="relative flex-col items-center justify-center mx-auto my-20 px-4 bg-white rounded shadow-sm border border-gray-500"
style={{ display: closeModal ? "none" : "flex" }} style={{ display: closeModal ? "none" : "flex" }}
> >
<div <div
className="bg-red-500 rounded-full p-2 absolute -top-5 right-10 cursor-pointer" className="p-2 absolute -top-5 right-10 bg-red-500 rounded-full cursor-pointer"
onClick={() => setCloseModal(true)} onClick={() => setCloseModal(true)}
> >
<img src={removeCard} alt="" className="w-5" /> <img src="images/card-remove.svg" alt="remove" className="w-5" />
</div> </div>
<h2 className="mt-10 text-productPrice"> <h2 className="mt-10 text-productPrice">{feedbakTitle}</h2>
نظر شما نسبت به رابط کاربری سایت جدیدمون چیه؟
</h2>
<div className="flex flex-row justify-between"> <div className="flex flex-row justify-between">
{feedbacks.map((item, index) => ( {feedbacks.map((item, index) => (
<div <div
className={`flex flex-col items-center mt-7 w-full px-4 ${activeFeedback ? 'pb-8' : 'pb-0'} relative cursor-pointer transition-all duration-500`} className={`flex flex-col items-center mt-7 w-full px-4 ${
activeFeedback ? "pb-8" : "pb-0"
} relative cursor-pointer transition-all duration-500`}
key={index} key={index}
onClick={() => setActiveFeedback(item)} onClick={() => setActiveFeedback(item)}
> >
@ -47,7 +38,7 @@ const Feedback = ({ feedbacks }) => {
{item.name} {item.name}
</p> </p>
<img <img
src={upwardArrow} src="images/gray-upward-icon.svg"
alt="" alt=""
className={`w-20 h-20 rounded-full absolute left-1/2 transform -translate-x-1/2 bottom-0 translate-y-2/3 z-10 transition-all duration-500 ${ className={`w-20 h-20 rounded-full absolute left-1/2 transform -translate-x-1/2 bottom-0 translate-y-2/3 z-10 transition-all duration-500 ${
activeFeedback === item ? "opacity-100" : "opacity-0" activeFeedback === item ? "opacity-100" : "opacity-0"
@ -75,25 +66,27 @@ const Feedback = ({ feedbacks }) => {
export default Feedback; export default Feedback;
Feedback.defaultProps = { Feedback.defaultProps = {
feedbakTitle: "نظر شما نسبت به رابط کاربری سایت جدیدمون چیه؟",
feedbacks: [ feedbacks: [
{ {
icon: heartEmoji, icon: "images/heart-emoji.svg",
name: "عالی", name: "عالی",
}, },
{ {
icon: smileEmoji, icon: "images/smile-emoji.svg",
name: "خوب", name: "خوب",
}, },
{ {
icon: speechlessEmoji, icon: "images/speechless-emoji.svg",
name: "اوکیه", name: "اوکیه",
}, },
{ {
icon: sadEmoji, icon: "images/sad-emoji.svg",
name: "بد", name: "بد",
}, },
{ {
icon: suspiciousEmoji, icon: "images/suspicious-emoji.svg",
name: "خیلی بد", name: "خیلی بد",
}, },
], ],

@ -15,6 +15,7 @@ import CounterDesign from "../components/CounterDesign";
import CourseList from "../components/CourseList"; import CourseList from "../components/CourseList";
import ProductFilter from "../components/ProductFilter"; import ProductFilter from "../components/ProductFilter";
import Features from "../components/Features"; import Features from "../components/Features";
import Feedback from "../components/Feedback";
// mini components // mini components
import MiniComponents from "../components/MiniComponents"; import MiniComponents from "../components/MiniComponents";
@ -279,6 +280,16 @@ const components = [
code: null, code: null,
}, },
}, },
{
name: "Feedback",
author: "Andalib",
props: [],
content: {
name: "Feedback",
component: <Feedback />,
code: null,
},
},
// mini components // mini components
{ {
name: "Mini Components", name: "Mini Components",

Loading…
Cancel
Save