Skip to content

Commit

Permalink
fix: move comma out of code block in SecurityRequirement.tsx (#1924)
Browse files Browse the repository at this point in the history
  • Loading branch information
J0sh0nat0r authored Mar 23, 2022
1 parent eb096b6 commit ab3e8a8
Showing 1 changed file with 24 additions and 10 deletions.
34 changes: 24 additions & 10 deletions src/components/SecurityRequirement/SecurityRequirement.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,23 @@ import { Link, UnderlinedHeader } from '../../common-elements/';
import { SecurityRequirementModel } from '../../services/models/SecurityRequirement';
import { linksCss } from '../Markdown/styled.elements';

const ScopeNameList = styled.ul`
display: inline;
list-style: none;
padding: 0;
li {
display: inherit;
&:after {
content: ',';
}
&:last-child:after {
content: none;
}
}
`;

const ScopeName = styled.code`
font-size: ${props => props.theme.typography.code.fontSize};
font-family: ${props => props.theme.typography.code.fontFamily};
Expand All @@ -14,13 +31,6 @@ const ScopeName = styled.code`
padding: 0.2em;
display: inline-block;
line-height: 1;
&:after {
content: ',';
}
&:last-child:after {
content: none;
}
`;

const SecurityRequirementAndWrap = styled.span`
Expand Down Expand Up @@ -72,9 +82,13 @@ export class SecurityRequirement extends React.PureComponent<SecurityRequirement
<SecurityRequirementAndWrap key={scheme.id}>
<Link to={scheme.sectionId}>{scheme.displayName}</Link>
{scheme.scopes.length > 0 && ' ('}
{scheme.scopes.map(scope => (
<ScopeName key={scope}>{scope}</ScopeName>
))}
<ScopeNameList>
{scheme.scopes.map(scope => (
<li key={scope}>
<ScopeName>{scope}</ScopeName>
</li>
))}
</ScopeNameList>
{scheme.scopes.length > 0 && ') '}
</SecurityRequirementAndWrap>
);
Expand Down

0 comments on commit ab3e8a8

Please sign in to comment.