diff --git a/apps/vyper/src/app/app.tsx b/apps/vyper/src/app/app.tsx index 0731d068bb..4fdb65b535 100644 --- a/apps/vyper/src/app/app.tsx +++ b/apps/vyper/src/app/app.tsx @@ -38,6 +38,7 @@ const App = () => { environment: 'remote', localUrl: 'http://localhost:8000/', }) + const [toggleAccordion, setToggleAccordion] = useState(false) useEffect(() => { async function start() { @@ -99,6 +100,9 @@ const App = () => { function resetCompilerResultState() { setOutput(remixClient.compilerOutput) } + const toggleAccordionHandler = () => { + setToggleAccordion(!toggleAccordion) + } return (
@@ -110,25 +114,24 @@ const App = () => { - - - - - Advanced Compiler Settings - - - -
-
- setEnvironment('remote')} label="Remote Compiler" className={`${state.environment === 'remote' ? 'd-flex mr-4' : 'd-flex mr-4 cursor-status'}`} - /> - setEnvironment('local')} label="Local Compiler" - className={`${state.environment === 'local' ? '' : `cursor-status`}`}/> -
-
-
-
-
+ + + + Advanced Compiler Settings + + + + +
+
+ setEnvironment('remote')} label="Remote Compiler" className={`${state.environment === 'remote' ? 'd-flex mr-4' : 'd-flex mr-4 cursor-status'}`} + /> + setEnvironment('local')} label="Local Compiler" + className={`${state.environment === 'local' ? '' : `cursor-status`}`}/> +
+
+
+
Specify the compiler version & EVM version in the .vy file diff --git a/apps/vyper/src/app/components/AccordionContextToggle.tsx b/apps/vyper/src/app/components/AccordionContextToggle.tsx new file mode 100644 index 0000000000..937020e699 --- /dev/null +++ b/apps/vyper/src/app/components/AccordionContextToggle.tsx @@ -0,0 +1,24 @@ +import React, { useContext } from 'react' +import { AccordionContext } from 'react-bootstrap' +import { useAccordionToggle } from 'react-bootstrap/AccordionToggle' + +function ContextAwareToggle({ children, eventKey, callback }) { + const currentEventKey = useContext(AccordionContext) + + const decoratedOnClick = useAccordionToggle( + eventKey, + () => callback && callback(eventKey), + ); + + const isCurrentEventKey = currentEventKey === eventKey; + + return ( + + ); +}