From: Jeremy Thomas Date: Thu, 27 Jun 2024 00:03:51 +0000 (+0100) Subject: Add open state X-Git-Tag: 1.0.2~5^2~6 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=bb62f531e14bb4d18c13df101c9634a734b541a7;p=thirdparty%2Fbulma.git Add open state --- 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 (