fix: bottom padding at the api editor (#7074)

This commit is contained in:
Rishabh Saxena 2021-09-02 23:56:30 +05:30 committed by GitHub
parent cbf7dc2745
commit 8b63b2029e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 52 additions and 33 deletions

View File

@ -73,7 +73,7 @@ const ResponseTabWrapper = styled.div`
`;
const TabbedViewWrapper = styled.div<{ isCentered: boolean }>`
height: calc(100% - 30px);
height: 100%;
&&& {
ul.react-tabs__tab-list {
@ -93,6 +93,12 @@ const TabbedViewWrapper = styled.div<{ isCentered: boolean }>`
}
`
: null}
& {
.react-tabs__tab-panel {
height: calc(100% - 32px);
}
}
`;
const SectionDivider = styled.div`
@ -112,7 +118,7 @@ const Flex = styled.div`
`;
const NoResponseContainer = styled.div`
height: 100%;
flex: 1;
width: 100%;
display: flex;
align-items: center;
@ -153,8 +159,8 @@ const InlineButton = styled(Button)`
`;
const HelpSection = styled.div`
margin-bottom: 5px;
margin-top: 10px;
padding-bottom: 5px;
padding-top: 10px;
`;
interface ReduxStateProps {
@ -188,6 +194,16 @@ const StatusCodeText = styled(BaseText)<{ code: string }>`
props.code.startsWith("2") ? props.theme.colors.primaryOld : Colors.RED};
`;
const ResponseDataContainer = styled.div`
flex: 1;
overflow: auto;
display: flex;
flex-direction: column;
& .CodeEditorTarget {
overflow: hidden;
}
`;
function ApiResponseView(props: Props) {
const {
match: {
@ -222,13 +238,14 @@ function ApiResponseView(props: Props) {
const initialIndex = useSelector(getActionTabsInitialIndex);
const [selectedIndex, setSelectedIndex] = useState(initialIndex);
const messages = response?.messages;
const tabs = [
{
key: "body",
title: "Response Body",
panelComponent: (
<ResponseTabWrapper>
{messages && (
{Array.isArray(messages) && messages.length > 0 && (
<HelpSection>
{messages.map((msg, i) => (
<Callout fill key={i} text={msg} variant={Variant.warning} />
@ -250,33 +267,35 @@ function ApiResponseView(props: Props) {
variant={Variant.danger}
/>
)}
{_.isEmpty(response.statusCode) ? (
<NoResponseContainer>
<Icon name="no-response" />
<Text type={TextType.P1}>
{EMPTY_RESPONSE_FIRST_HALF()}
<InlineButton
isLoading={isRunning}
onClick={onRunClick}
size={Size.medium}
tag="button"
text="Run"
type="button"
/>
{EMPTY_RESPONSE_LAST_HALF()}
</Text>
</NoResponseContainer>
) : (
<ReadOnlyEditor
folding
height={"100%"}
input={{
value: response.body
? JSON.stringify(response.body, null, 2)
: "",
}}
/>
)}
<ResponseDataContainer>
{_.isEmpty(response.statusCode) ? (
<NoResponseContainer>
<Icon name="no-response" />
<Text type={TextType.P1}>
{EMPTY_RESPONSE_FIRST_HALF()}
<InlineButton
isLoading={isRunning}
onClick={onRunClick}
size={Size.medium}
tag="button"
text="Run"
type="button"
/>
{EMPTY_RESPONSE_LAST_HALF()}
</Text>
</NoResponseContainer>
) : (
<ReadOnlyEditor
folding
height={"100%"}
input={{
value: response.body
? JSON.stringify(response.body, null, 2)
: "",
}}
/>
)}
</ResponseDataContainer>
</ResponseTabWrapper>
),
},

View File

@ -190,7 +190,7 @@ const Link = styled.a`
const Wrapper = styled.div`
display: flex;
flex-direction: row;
height: calc(100% - 126px);
height: calc(100% - 118px);
position: relative;
`;
interface APIFormProps {