Skip to content

Commit

Permalink
fix: display response code at the top after adding a line break (#1374)
Browse files Browse the repository at this point in the history
* fix: display response code at the top after adding a line break

* chore: rename component from Strong to Code
  • Loading branch information
stasiukanya committed Sep 3, 2020
1 parent 4e7c722 commit c801b87
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
3 changes: 2 additions & 1 deletion src/components/Responses/ResponseTitle.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import * as React from 'react';

import { Code } from './styled.elements';
import { ShelfIcon } from '../../common-elements';
import { Markdown } from '../Markdown/Markdown';

Expand Down Expand Up @@ -31,7 +32,7 @@ export class ResponseTitle extends React.PureComponent<ResponseTitleProps> {
float={'left'}
/>
)}
<strong>{code} </strong>
<Code>{code} </Code>
<Markdown compact={true} inline={true} source={title} />
</button>
);
Expand Down
12 changes: 8 additions & 4 deletions src/components/Responses/styled.elements.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ export const StyledResponseTitle = styled(ResponseTitle)`
background-color: #f2f2f2;
cursor: pointer;
color: ${props => props.theme.colors.responses[props.type].color};
background-color: ${props => props.theme.colors.responses[props.type].backgroundColor};
color: ${(props) => props.theme.colors.responses[props.type].color};
background-color: ${(props) => props.theme.colors.responses[props.type].backgroundColor};
&:focus {
outline: auto;
outline-color: ${props => props.theme.colors.responses[props.type].color};
outline-color: ${(props) => props.theme.colors.responses[props.type].color};
}
${props =>
${(props) =>
(props.empty &&
`
cursor: default;
Expand All @@ -49,3 +49,7 @@ export const HeadersCaption = styled(UnderlinedHeader.withComponent('caption'))`
margin-top: 1em;
caption-side: top;
`;

export const Code = styled.strong`
vertical-align: top;
`;

0 comments on commit c801b87

Please sign in to comment.