From ae08ba71456faaa93f31c685ae16ac2962716807 Mon Sep 17 00:00:00 2001 From: Fisico Date: Fri, 8 Mar 2024 23:39:48 +0100 Subject: [PATCH] animate icon --- src/containers/MenuItem.js | 5 ++++- src/containers/TheSidebar.js | 22 +++++++++++----------- src/scss/sidebar.scss | 3 +++ 3 files changed, 18 insertions(+), 12 deletions(-) diff --git a/src/containers/MenuItem.js b/src/containers/MenuItem.js index 4aabe36..a362ac7 100644 --- a/src/containers/MenuItem.js +++ b/src/containers/MenuItem.js @@ -1,5 +1,6 @@ import React, { useState } from 'react'; import { FaAngleDown, FaAngleUp } from "react-icons/fa"; +import { motion } from 'framer-motion'; const MenuItem = ({ label, icon, onClick, isActive, children, link }) => { const [isOpen, setIsOpen] = useState(false); @@ -24,7 +25,9 @@ const MenuItem = ({ label, icon, onClick, isActive, children, link }) => {
{icon}

{label}

-
{children && (isOpen ? : )}
+ {children && + + }
{isOpen && children} diff --git a/src/containers/TheSidebar.js b/src/containers/TheSidebar.js index 5c05281..9f639ae 100644 --- a/src/containers/TheSidebar.js +++ b/src/containers/TheSidebar.js @@ -35,12 +35,12 @@ const TheSidebar = ({ showSidebar, setShowSidebar, isMobile }) => { const menuItems = [ - { label: 'Groups', icon: , link: '#' }, - { label: 'Lights', icon: , link: '#lights' }, - { label: 'Devices', icon: , link: '#devices' }, + { label: 'Groups', icon: , link: '#' }, + { label: 'Lights', icon: , link: '#lights' }, + { label: 'Devices', icon: , link: '#devices' }, { label: 'DIYHue', - icon: , + icon: , link: '#diyhue', subItems: [ { label: 'Linkbutton', icon: , link: '#linkbutton' }, @@ -52,17 +52,17 @@ const TheSidebar = ({ showSidebar, setShowSidebar, isMobile }) => { }, { label: 'Addons', - icon: , + icon: , link: '#addons', subItems: [ - { label: 'MQTT', icon: , link: '#mqtt' }, - { label: 'HA', icon: , link: '#ha' }, - { label: 'Tradfri', icon: , link: '#tradfri' }, - { label: 'Deconz', icon: , link: '#deconz' }, - { label: 'Phillips', icon: , link: '#hue' }, + { label: 'MQTT', icon: , link: '#mqtt' }, + { label: 'HA', icon: , link: '#ha' }, + { label: 'Tradfri', icon: , link: '#tradfri' }, + { label: 'Deconz', icon: , link: '#deconz' }, + { label: 'Phillips', icon: , link: '#hue' }, ] }, - { label: 'Logout', icon: , link: 'logout' }, + { label: 'Logout', icon: , link: 'logout' }, ]; return ( diff --git a/src/scss/sidebar.scss b/src/scss/sidebar.scss index 359dc95..dcaee10 100644 --- a/src/scss/sidebar.scss +++ b/src/scss/sidebar.scss @@ -22,6 +22,9 @@ .submenuIcon{ margin-left: auto; + display: flex; + align-items: center; + justify-content: center; } }