1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
5 import * as React from 'react';
7 export interface AdvancedViewSwitchInjectedProps {
8 toggleAdvancedView: () => void;
9 advancedViewOpen: boolean;
12 export const connectAdvancedViewSwitch = (Component: React.ComponentType<AdvancedViewSwitchInjectedProps>) =>
13 class extends React.Component<{}, { advancedViewOpen: boolean }> {
15 state = { advancedViewOpen: false };
17 toggleAdvancedView = () => {
18 this.setState(({ advancedViewOpen }) => ({ advancedViewOpen: !advancedViewOpen }));
22 return <Component {...this.state} {...this} />;