diff --git a/apps/vyper/src/app/app.tsx b/apps/vyper/src/app/app.tsx index 4fdb65b535..adfb54d021 100644 --- a/apps/vyper/src/app/app.tsx +++ b/apps/vyper/src/app/app.tsx @@ -18,6 +18,7 @@ import './app.css' import {CustomTooltip} from '@remix-ui/helper' import { Form} from 'react-bootstrap' import {CompileErrorCard} from './components/CompileErrorCard' +import CustomAccordionToggle from './components/CustomAccordionToggle' interface AppState { status: 'idle' | 'inProgress' @@ -38,7 +39,6 @@ const App = () => { environment: 'remote', localUrl: 'http://localhost:8000/', }) - const [toggleAccordion, setToggleAccordion] = useState(false) useEffect(() => { async function start() { @@ -100,9 +100,9 @@ const App = () => { function resetCompilerResultState() { setOutput(remixClient.compilerOutput) } - const toggleAccordionHandler = () => { - setToggleAccordion(!toggleAccordion) - } + + const [toggleAccordion, setToggleAccordion] = useState(false) + return (
@@ -114,14 +114,17 @@ const App = () => { - - - - Advanced Compiler Settings - - + +
+
+ + Advanced Compiler Settings + + {/* */} + +
- +
setEnvironment('remote')} label="Remote Compiler" className={`${state.environment === 'remote' ? 'd-flex mr-4' : 'd-flex mr-4 cursor-status'}`} @@ -130,9 +133,9 @@ const App = () => { 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 deleted file mode 100644 index 937020e699..0000000000 --- a/apps/vyper/src/app/components/AccordionContextToggle.tsx +++ /dev/null @@ -1,24 +0,0 @@ -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 ( - - ); -} diff --git a/apps/vyper/src/app/components/CustomAccordionToggle.tsx b/apps/vyper/src/app/components/CustomAccordionToggle.tsx new file mode 100644 index 0000000000..c4a5ce98b5 --- /dev/null +++ b/apps/vyper/src/app/components/CustomAccordionToggle.tsx @@ -0,0 +1,27 @@ +import React, { useContext, useState } from 'react' +import { AccordionContext } from 'react-bootstrap' +import { useAccordionToggle } from 'react-bootstrap/AccordionToggle' + +export type CustomAccordionToggleProps = { + children: React.ReactNode + eventKey: string + callback?: any +} + +export default function CustomAccordionToggle({ children, eventKey }: CustomAccordionToggleProps) { + const [toggleAccordion, setToggleAccordion] = useState(false) + // + + const decoratedOnClick = useAccordionToggle(eventKey, () => + setToggleAccordion(!toggleAccordion) + ) + + + return ( +
+ {children} +
+ ) +}