import React, { useState } from 'react'; import classnames from 'classnames'; import QueryResult from './QueryResult'; import Overlay from './Overlay'; import Placeholder from './Placeholder'; import ResponseHeaders from './ResponseHeaders'; import StatusCode from './StatusCode'; import ResponseTime from './ResponseTime'; import ResponseSize from './ResponseSize'; import StyledWrapper from './StyledWrapper'; const ResponsePane = ({rightPaneWidth, response, isLoading}) => { const [selectedTab, setSelectedTab] = useState('response'); response = response || {}; const getTabClassname = (tabName) => { return classnames(`tab select-none ${tabName}`, { 'active': tabName === selectedTab }); }; const getTabPanel = (tab) => { switch(tab) { case 'response': { return ( ); } case 'headers': { return ( ); } default: { return 404 | Not found; } } } if(isLoading) { return ( ); } if(response.state !== 'success') { return ( ); } return ( setSelectedTab('response')}>Response setSelectedTab('headers')}>Headers {!isLoading ? ( ) : null } {getTabPanel(selectedTab)} ) }; export default ResponsePane;