Skip to content

Commit 5da3843

Browse files
committed
Refactor: use ternary operators at attribute level instead of element level
1 parent f63d2b1 commit 5da3843

File tree

2 files changed

+12
-24
lines changed

2 files changed

+12
-24
lines changed

src/core/components/operation.jsx

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -161,18 +161,12 @@ export default class Operation extends PureComponent {
161161
<div className={`opblock-summary opblock-summary-${method}`} onClick={this.toggleShown} >
162162
<span className="opblock-summary-method">{method.toUpperCase()}</span>
163163
<span className={ deprecated ? "opblock-summary-path__deprecated" : "opblock-summary-path" } >
164-
{
165-
isDeepLinkingEnabled ?
166-
<a
167-
className="nostyle"
168-
onClick={(e) => e.preventDefault()}
169-
href={`#/${isShownKey[1]}/${isShownKey[2]}`}>
170-
<span>{path}</span>
171-
</a> :
172-
<a className="nostyle">
173-
<span>{path}</span>
174-
</a>
175-
}
164+
<a
165+
className="nostyle"
166+
onClick={isDeepLinkingEnabled ? (e) => e.preventDefault() : null}
167+
href={isDeepLinkingEnabled ? `#/${isShownKey[1]}/${isShownKey[2]}` : null}>
168+
<span>{path}</span>
169+
</a>
176170
<JumpToPath path={jumpToKey} />
177171
</span>
178172

src/core/components/operations.jsx

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -79,18 +79,12 @@ export default class Operations extends React.Component {
7979
onClick={() => layoutActions.show(isShownKey, !showTag)}
8080
className={!tagDescription ? "opblock-tag no-desc" : "opblock-tag" }
8181
id={isShownKey.join("-")}>
82-
{
83-
isDeepLinkingEnabled ?
84-
<a
85-
className="nostyle"
86-
onClick={(e) => e.preventDefault()}
87-
href= {`#/${tag}`}>
88-
<span>{tag}</span>
89-
</a>:
90-
<a className="nostyle">
91-
<span>{tag}</span>
92-
</a>
93-
}
82+
<a
83+
className="nostyle"
84+
onClick={isDeepLinkingEnabled ? (e) => e.preventDefault() : null}
85+
href= {isDeepLinkingEnabled ? `#/${tag}` : null}>
86+
<span>{tag}</span>
87+
</a>
9488
{ !tagDescription ? null :
9589
<small>
9690
{ tagDescription }

0 commit comments

Comments
 (0)