Render class import with constructor conditionally

This commit is contained in:
ahocevar
2018-05-20 14:33:40 +02:00
committed by Tim Schaub
parent a224e51c3f
commit a7d180047a
+12 -5
View File
@@ -82,15 +82,22 @@ class Docs extends Component {
); );
} }
renderClass(cls, mod) { renderConstructor(cls, mod) {
return cls in mod.classes && cls in mod.classes[cls] ? ( if (cls in mod.classes && cls in mod.classes[cls]) {
<div key={cls}> return (
<div>
<p>{this.renderImport(cls, mod)}</p> <p>{this.renderImport(cls, mod)}</p>
<h3>new {getName(cls)}()</h3> <h4>new {getName(cls)}()</h4>
</div> </div>
) : ( );
}
}
renderClass(cls, mod) {
return (
<div key={cls}> <div key={cls}>
<h3>{getName(cls)}</h3> <h3>{getName(cls)}</h3>
{this.renderConstructor(cls, mod)}
</div> </div>
); );
} }