mirror of
https://github.com/Redocly/redoc.git
synced 2025-02-17 02:10:39 +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="operations">
|
||||||
<div class="tag" *ngFor="let tag of tags; trackBy:trackByTagName" [attr.section]="tag.id">
|
<div class="tag" *ngFor="let tag of tags; trackBy:trackByTagName" [attr.section]="tag.id">
|
||||||
<div class="tag-info" *ngIf="tag.name">
|
<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>
|
<p *ngIf="tag.description" [innerHtml]="tag.description | marked"> </p>
|
||||||
<redoc-externalDocs [docs]="tag.metadata.externalDocs"></redoc-externalDocs>
|
<redoc-externalDocs [docs]="tag.metadata.externalDocs"></redoc-externalDocs>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -12,7 +12,6 @@
|
||||||
.tag-info {
|
.tag-info {
|
||||||
padding: $section-spacing;
|
padding: $section-spacing;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
background-color: white;
|
|
||||||
width: 60%;
|
width: 60%;
|
||||||
|
|
||||||
@media (max-width: $right-panel-squash-breakpoint) {
|
@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) return;
|
||||||
|
|
||||||
if (menuItem.metadata.type === 'tag') {
|
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) {
|
if (menuItem.metadata.type === 'operation' && !menuItem.parent) {
|
||||||
emptyTag.items.push(menuItem);
|
emptyTag.items.push(menuItem);
|
||||||
|
@ -39,6 +42,11 @@ export class OperationsList extends BaseComponent implements OnInit {
|
||||||
if (emptyTag.items.length) this.tags.push(emptyTag);
|
if (emptyTag.items.length) this.tags.push(emptyTag);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
buildAnchor(tagId):string {
|
||||||
|
return this.menu.hashFor(tagId,
|
||||||
|
{ type: 'tag'});
|
||||||
|
}
|
||||||
|
|
||||||
trackByTagName(_, el) {
|
trackByTagName(_, el) {
|
||||||
return el.name;
|
return el.name;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user