From bb62f531e14bb4d18c13df101c9634a734b541a7 Mon Sep 17 00:00:00 2001 From: Jeremy Thomas Date: Thu, 27 Jun 2024 01:03:51 +0100 Subject: [PATCH] Add open state --- docs/_react/bulma-customizer/src/App.jsx | 30 ++++++++++++++++++- .../bulma-customizer/src/App.module.css | 16 ++++++++++ 2 files changed, 45 insertions(+), 1 deletion(-) diff --git a/docs/_react/bulma-customizer/src/App.jsx b/docs/_react/bulma-customizer/src/App.jsx index 1c490f16..51747a41 100644 --- a/docs/_react/bulma-customizer/src/App.jsx +++ b/docs/_react/bulma-customizer/src/App.jsx @@ -138,6 +138,7 @@ const PAGE_IDS = { }; export const CustomizerContext = createContext({ + isOpen: false, cssvars: {}, currentTab: "", currentPage: "", @@ -150,6 +151,7 @@ export const CustomizerContext = createContext({ function App() { const styleRef = useRef(); const initialContext = { + isOpen: true, cssvars: {}, currentTab: "Global Variables", currentPage: "delete", @@ -201,6 +203,17 @@ function App() { context.changePage(pageId); }; + const handleOpening = (event) => { + event.preventDefault(); + + setContext((context) => { + return { + ...context, + isOpen: !context.isOpen, + }; + }); + }; + useEffect(() => { const styles = { root: window.getComputedStyle(document.documentElement), @@ -400,10 +413,21 @@ function App() { "--bulma-tabs-link-active-color": "var(--bulma-primary)", }; + const appClass = classNames({ + [cn.app]: true, + [cn.open]: context.isOpen, + }); + + const buttonClass = classNames({ + [cn.button]: true, + "button is-primary": true, + }); + return (