@@ -24,36 +24,61 @@ const ScopeName = styled.code`
24
24
}
25
25
` ;
26
26
27
- const SecurityRequirementWrap = styled . span `
27
+ const SecurityRequirementAndWrap = styled . span `
28
28
&:after {
29
- content: ' OR ';
29
+ content: ' AND ';
30
30
font-weight: bold;
31
31
}
32
+
32
33
&:last-child:after {
33
34
content: none;
34
35
}
35
36
36
37
${ linksCss } ;
37
38
` ;
38
39
40
+ const SecurityRequirementOrWrap = styled . span `
41
+ &:before {
42
+ content: '( ';
43
+ font-weight: bold;
44
+ }
45
+ &:after {
46
+ content: ' ) OR ';
47
+ font-weight: bold;
48
+ }
49
+ &:last-child:after {
50
+ content: ' )';
51
+ }
52
+
53
+ &:only-child:before,
54
+ &:only-child:after {
55
+ content: none;
56
+ }
57
+
58
+ ${ linksCss } ;
59
+ ` ;
60
+
39
61
export interface SecurityRequirementProps {
40
62
security : SecurityRequirementModel ;
41
63
}
42
64
43
65
export class SecurityRequirement extends React . PureComponent < SecurityRequirementProps > {
44
66
render ( ) {
45
67
const security = this . props . security ;
46
- return security . schemes . map ( ( scheme , idx ) => {
47
- return (
48
- < SecurityRequirementWrap key = { scheme . id } >
49
- < a href = { '#' + scheme . sectionId } > { scheme . id } </ a >
50
- { scheme . scopes . length > 0 && ' (' }
51
- { scheme . scopes . map ( scope => < ScopeName key = { scope } > { scope } </ ScopeName > ) }
52
- { scheme . scopes . length > 0 && ') ' }
53
- { idx < security . schemes . length - 1 && ' & ' }
54
- </ SecurityRequirementWrap >
55
- ) ;
56
- } ) ;
68
+ return (
69
+ < SecurityRequirementOrWrap >
70
+ { security . schemes . map ( scheme => {
71
+ return (
72
+ < SecurityRequirementAndWrap key = { scheme . id } >
73
+ < a href = { '#' + scheme . sectionId } > { scheme . id } </ a >
74
+ { scheme . scopes . length > 0 && ' (' }
75
+ { scheme . scopes . map ( scope => < ScopeName key = { scope } > { scope } </ ScopeName > ) }
76
+ { scheme . scopes . length > 0 && ') ' }
77
+ </ SecurityRequirementAndWrap >
78
+ ) ;
79
+ } ) }
80
+ </ SecurityRequirementOrWrap >
81
+ ) ;
57
82
}
58
83
}
59
84
0 commit comments