chore: codemirror editor occupy remaing height

This commit is contained in:
Anoop M D 2022-01-26 03:00:21 +05:30
parent 6812494d6b
commit 2007ff3a67
7 changed files with 18 additions and 16 deletions

View File

@ -50,9 +50,6 @@ const StyledWrapper = styled.div`
} }
} }
.react-tabs__tab-panel--selected {
height: 90%;
}
`; `;
export default StyledWrapper; export default StyledWrapper;

View File

@ -13,13 +13,15 @@ const GraphQLRequestPane = ({onRunQuery, schema, leftPaneWidth, value, onQueryCh
<Tab tabIndex="-1">Headers</Tab> <Tab tabIndex="-1">Headers</Tab>
</TabList> </TabList>
<TabPanel> <TabPanel>
<QueryEditor <div className="mt-4">
schema={schema} <QueryEditor
width={leftPaneWidth} schema={schema}
value={value} width={leftPaneWidth}
onRunQuery={onRunQuery} value={value}
onEdit={onQueryChange} onRunQuery={onRunQuery}
/> onEdit={onQueryChange}
/>
</div>
</TabPanel> </TabPanel>
<TabPanel> <TabPanel>
<RequestHeaders /> <RequestHeaders />

View File

@ -3,7 +3,8 @@ import styled from 'styled-components';
const StyledWrapper = styled.div` const StyledWrapper = styled.div`
div.CodeMirror { div.CodeMirror {
border: solid 1px var(--color-codemirror-border); border: solid 1px var(--color-codemirror-border);
height: 96%; /* todo: find a better way */
height: calc(100vh - 230px);
} }
textarea.cm-editor { textarea.cm-editor {

View File

@ -169,7 +169,7 @@ export default class QueryEditor extends React.Component {
render() { render() {
return ( return (
<StyledWrapper <StyledWrapper
className="mt-4 h-full" className="h-full"
aria-label="Query Editor" aria-label="Query Editor"
ref={node => { ref={node => {
this._node = node; this._node = node;

View File

@ -3,6 +3,8 @@ import styled from 'styled-components';
const StyledWrapper = styled.div` const StyledWrapper = styled.div`
div.CodeMirror { div.CodeMirror {
border: solid 1px var(--color-codemirror-border); border: solid 1px var(--color-codemirror-border);
/* todo: find a better way */
height: calc(100vh - 230px);
} }
div.overlay{ div.overlay{

View File

@ -37,7 +37,7 @@ const QueryResult = ({data, isLoading, width}) => {
}, [editor.current, cmEditor, data]); }, [editor.current, cmEditor, data]);
return ( return (
<StyledWrapper className="mt-4 w-full" style={{position: 'relative', height: '90%'}}> <StyledWrapper className="mt-4 w-full">
{isLoading && ( {isLoading && (
<div className="overlay"> <div className="overlay">
<div style={{marginBottom: 15, fontSize: 26}}> <div style={{marginBottom: 15, fontSize: 26}}>
@ -53,7 +53,7 @@ const QueryResult = ({data, isLoading, width}) => {
</button> </button>
</div> </div>
)} )}
<div> <div className="h-full">
<textarea <textarea
id="operation" id="operation"
style={{ style={{

View File

@ -6,8 +6,8 @@ const ResponseTime = ({duration}) => {
if(duration > 1000 ) { // duration greater than a second if(duration > 1000 ) { // duration greater than a second
let seconds = Math.floor(duration / 1000); let seconds = Math.floor(duration / 1000);
let decimal = ((duration % 1000) / 1000).toFixed(2) * 100; let decimal = ((duration % 1000) / 1000) * 100;
durationToDisplay = seconds + '.' + decimal + 's'; durationToDisplay = seconds + '.' + decimal.toFixed(0) + 's';
} else { } else {
durationToDisplay = duration + 'ms' durationToDisplay = duration + 'ms'
} }