mirror of
https://github.com/Redocly/redoc.git
synced 2024-12-01 21:03:45 +03:00
parent
0045958d3b
commit
f96c481b34
|
@ -24,12 +24,34 @@ const ScopeName = styled.code`
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const SecurityRequirementWrap = styled.span`
|
const SecurityRequirementAndWrap = styled.span`
|
||||||
&:after {
|
&:after {
|
||||||
content: ' OR ';
|
content: ' AND ';
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
&:last-child:after {
|
||||||
|
content: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
${linksCss};
|
||||||
|
`;
|
||||||
|
|
||||||
|
const SecurityRequirementOrWrap = styled.span`
|
||||||
|
&:before {
|
||||||
|
content: '( ';
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
&:after {
|
||||||
|
content: ' ) OR ';
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
&:last-child:after {
|
&:last-child:after {
|
||||||
|
content: ' )';
|
||||||
|
}
|
||||||
|
|
||||||
|
&:only-child:before,
|
||||||
|
&:only-child:after {
|
||||||
content: none;
|
content: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,17 +65,20 @@ export interface SecurityRequirementProps {
|
||||||
export class SecurityRequirement extends React.PureComponent<SecurityRequirementProps> {
|
export class SecurityRequirement extends React.PureComponent<SecurityRequirementProps> {
|
||||||
render() {
|
render() {
|
||||||
const security = this.props.security;
|
const security = this.props.security;
|
||||||
return security.schemes.map((scheme, idx) => {
|
|
||||||
return (
|
return (
|
||||||
<SecurityRequirementWrap key={scheme.id}>
|
<SecurityRequirementOrWrap>
|
||||||
|
{security.schemes.map(scheme => {
|
||||||
|
return (
|
||||||
|
<SecurityRequirementAndWrap key={scheme.id}>
|
||||||
<a href={'#' + scheme.sectionId}>{scheme.id}</a>
|
<a href={'#' + scheme.sectionId}>{scheme.id}</a>
|
||||||
{scheme.scopes.length > 0 && ' ('}
|
{scheme.scopes.length > 0 && ' ('}
|
||||||
{scheme.scopes.map(scope => <ScopeName key={scope}>{scope}</ScopeName>)}
|
{scheme.scopes.map(scope => <ScopeName key={scope}>{scope}</ScopeName>)}
|
||||||
{scheme.scopes.length > 0 && ') '}
|
{scheme.scopes.length > 0 && ') '}
|
||||||
{idx < security.schemes.length - 1 && ' & '}
|
</SecurityRequirementAndWrap>
|
||||||
</SecurityRequirementWrap>
|
);
|
||||||
|
})}
|
||||||
|
</SecurityRequirementOrWrap>
|
||||||
);
|
);
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user