diff --git a/package-lock.json b/package-lock.json index f7f5128bc..ee44b0e4e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@xola/ui-kit", - "version": "2.1.39", + "version": "2.1.42", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@xola/ui-kit", - "version": "2.1.39", + "version": "2.1.42", "license": "MIT", "dependencies": { "@headlessui/react": "^1.4.0", diff --git a/package.json b/package.json index e99c8b548..793f62c6e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@xola/ui-kit", - "version": "2.1.39", + "version": "2.1.42", "description": "Xola UI Kit", "license": "MIT", "files": [ diff --git a/src/components/Forms/BaseInput.jsx b/src/components/Forms/BaseInput.jsx index 50ab733f0..fcae97084 100644 --- a/src/components/Forms/BaseInput.jsx +++ b/src/components/Forms/BaseInput.jsx @@ -25,7 +25,7 @@ export const BaseInput = ({ as: Tag, size = "medium", isError, className, isRequ sizes[size], isError ? "!focus:border-danger !border-danger focus:ring-0 focus:ring-danger" - : "!border-gray-light focus:border-primary focus:ring-0 focus:ring-primary", + : "border-gray-light focus:border-primary focus:ring-0 focus:ring-primary", className, )} value={value} diff --git a/src/components/Sidebar/Sidebar.jsx b/src/components/Sidebar/Sidebar.jsx index eaabec53b..b96f88edc 100644 --- a/src/components/Sidebar/Sidebar.jsx +++ b/src/components/Sidebar/Sidebar.jsx @@ -1,6 +1,6 @@ import clsx from "clsx"; import PropTypes from "prop-types"; -import React, { useState, useEffect } from "react"; +import React from "react"; import { AnnounceIcon } from "../../icons/AnnounceIcon"; import { BellIcon } from "../../icons/BellIcon"; import { XolaLogoSimple } from "../../icons/images/XolaLogoSimple"; @@ -29,52 +29,12 @@ export const Sidebar = ({ onLogoClick, isStickyHeader = true, isStickyFooter = true, + isLeftDrawerOpen, + isRightDrawerOpen, + handleDrawerStateChange, }) => { - const [isLeftDrawerOpen, setIsLeftDrawerOpen] = useState(false); - const [isRightDrawerOpen, setIsRightDrawerOpen] = useState(false); - - useEffect(() => { - setIsLeftDrawerOpen(false); // Close the drawer if notifications changes - setIsRightDrawerOpen(false); - }, [notifications]); - - const toggleLeftDrawer = () => { - if (!isLeftDrawerOpen) { - // Close the right drawer when you open the left - setIsRightDrawerOpen(false); - } - - setIsLeftDrawerOpen(!isLeftDrawerOpen); - }; - - const toggleRightDrawer = () => { - if (!isRightDrawerOpen) { - // Close the left drawer when you open the right - setIsLeftDrawerOpen(false); - } - - setIsRightDrawerOpen(!isRightDrawerOpen); - }; - const { announcements: leftDrawer, notices: rightDrawer } = notifications ?? {}; const hideRightDrawer = rightDrawer?.count <= 0 || !rightDrawer; - - const handleOnClose = (direction, closeDrawer) => { - if (direction === "left") { - if (closeDrawer) { - setIsLeftDrawerOpen(false); - } - - leftDrawer.onClose?.(); - } else { - if (closeDrawer) { - setIsRightDrawerOpen(false); - } - - rightDrawer.onClose?.(); - } - }; - const isStickyHeaderFooter = isStickyHeader && isStickyFooter; return ( @@ -97,7 +57,7 @@ export const Sidebar = ({ > {leftDrawer && (