Skip to content

Commit

Permalink
fix row buttons close
Browse files Browse the repository at this point in the history
  • Loading branch information
hendriksen-mark committed May 11, 2024
1 parent 5f6fdef commit 49fc125
Showing 1 changed file with 40 additions and 36 deletions.
76 changes: 40 additions & 36 deletions src/components/Group/ButtonRow.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from "react";

import { FaPalette, FaImages, FaLightbulb } from "react-icons/fa";
import { MdInvertColors } from "react-icons/md";
import { motion } from "framer-motion";
import { motion, AnimatePresence } from "framer-motion";

const ButtonRow = ({
showContainer,
Expand All @@ -20,55 +20,59 @@ const ButtonRow = ({
};

return (
<>
{showContainer !== "closed" && (
<motion.div
className="row buttons"
initial="closed"
animate={showContainer === "closed" ? "closed" : "opened"}
variants={barIconVariants}
>
{lightsCapabilities.includes("xy") && (
<AnimatePresence mode="wait">
{showContainer !== "closed" && (
<motion.div
key="buttons"
className="row buttons"
initial="closed"
animate="opened"
exit="closed"
variants={barIconVariants}
transition={{
duration: 0.2,
}}
>
{lightsCapabilities.includes("xy") && (
<motion.div
className={"btn"}
whileHover={{ scale: 1.2 }}
whileTap={{ scale: 0.9 }}
>
<FaPalette onClick={() => setShowContainer("colorPicker")} />
</motion.div>
)}

{lightsCapabilities.includes("ct") && (
<motion.div
className={"btn"}
whileHover={{ scale: 1.2 }}
whileTap={{ scale: 0.9 }}
>
<MdInvertColors
onClick={() => setShowContainer("colorTempPicker")}
/>
</motion.div>
)}

<motion.div
className={"btn"}
whileHover={{ scale: 1.2 }}
whileTap={{ scale: 0.9 }}
variants={barIconVariants}
>
<FaPalette onClick={() => setShowContainer("colorPicker")} />
<FaImages onClick={() => setSceneModal(true)} />
</motion.div>
)}

{lightsCapabilities.includes("ct") && (
<motion.div
className={"btn"}
whileHover={{ scale: 1.2 }}
whileTap={{ scale: 0.9 }}
>
<MdInvertColors
onClick={() => setShowContainer("colorTempPicker")}
/>
<FaLightbulb onClick={() => setShowContainer("lights")} />
</motion.div>
)}

<motion.div
className="btn"
whileHover={{ scale: 1.2 }}
whileTap={{ scale: 0.9 }}
>
<FaImages onClick={() => setSceneModal(true)} />
</motion.div>

<motion.div
className="btn"
whileHover={{ scale: 1.2 }}
whileTap={{ scale: 0.9 }}
>
<FaLightbulb onClick={() => setShowContainer("lights")} />
</motion.div>
</motion.div>
)}
</>
)}
</AnimatePresence>
);
};

Expand Down

0 comments on commit 49fc125

Please sign in to comment.