mirror of
https://github.com/Redocly/redoc.git
synced 2024-11-22 16:46:34 +03:00
chore: operation list minor refactor
This commit is contained in:
parent
6077cc6afd
commit
4839b3ce69
|
@ -1,7 +1,7 @@
|
|||
<div class="operations">
|
||||
<div class="tag" *ngFor="let tag of tags; trackBy:trackByTagName" [attr.section]="tag.id">
|
||||
<div class="tag-info" *ngIf="tag.name">
|
||||
<h1 class="sharable-header"> <a class="share-link" href="#{{tag.id}}"></a>{{tag.name}} </h1>
|
||||
<h1 class="sharable-header"> <a class="share-link" href="#{{tag.anchor}}"></a>{{tag.name}} </h1>
|
||||
<p *ngIf="tag.description" [innerHtml]="tag.description | marked"> </p>
|
||||
<redoc-externalDocs [docs]="tag.metadata.externalDocs"></redoc-externalDocs>
|
||||
</div>
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
.tag-info {
|
||||
padding: $section-spacing;
|
||||
box-sizing: border-box;
|
||||
background-color: white;
|
||||
width: 60%;
|
||||
|
||||
@media (max-width: $right-panel-squash-breakpoint) {
|
||||
|
|
|
@ -30,7 +30,10 @@ export class OperationsList extends BaseComponent implements OnInit {
|
|||
if (!menuItem.metadata) return;
|
||||
|
||||
if (menuItem.metadata.type === 'tag') {
|
||||
this.tags.push(menuItem);
|
||||
this.tags.push({
|
||||
...menuItem,
|
||||
anchor: this.buildAnchor(menuItem.id)
|
||||
});
|
||||
}
|
||||
if (menuItem.metadata.type === 'operation' && !menuItem.parent) {
|
||||
emptyTag.items.push(menuItem);
|
||||
|
@ -39,6 +42,11 @@ export class OperationsList extends BaseComponent implements OnInit {
|
|||
if (emptyTag.items.length) this.tags.push(emptyTag);
|
||||
}
|
||||
|
||||
buildAnchor(tagId):string {
|
||||
return this.menu.hashFor(tagId,
|
||||
{ type: 'tag'});
|
||||
}
|
||||
|
||||
trackByTagName(_, el) {
|
||||
return el.name;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user