Skip to content

Commit

Permalink
new: http verb badges in search results
Browse files Browse the repository at this point in the history
  • Loading branch information
RomanHotsiy committed Apr 19, 2017
1 parent 9c4bc59 commit 61fd426
Show file tree
Hide file tree
Showing 5 changed files with 74 additions and 60 deletions.
67 changes: 67 additions & 0 deletions lib/components/Redoc/redoc.scss
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,73 @@ side-menu {
font-size: 18px;
}

/* global menu items styles (search results + menu) */
:host /deep/ {
.menu-item-header > span {
display: inline-block;
vertical-align: middle;
}

.menu-item-header > .operation-type + .menu-item-title {
width: calc(100% - 32px); // 32 = 26px image width + 6px margin left
}

.menu-item-header > .operation-type {
width: 26px;
display: inline-block;
height: 13px;
background-color: #333;
border-radius: 3px;
vertical-align: top;
background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABMAAACgCAYAAADuDlcXAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyRpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veG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bHLvsifSWFVAVEzo2VDTxxb9T16eO7sF0vmxPNPxPFHgAEA/rGUMXq/uWcAAAAASUVORK5CYII=');
background-repeat: no-repeat;
background-position: 6px 4px;
text-indent: -9000px;
margin-right: 6px;
margin-top: 2px;

&.get {
background-position: 8px -12px;
background-color: $get-color;
}

&.post {
background-position: 6px 4px;
background-color: $post-color;
}

&.put {
background-position: 8px -28px;
background-color: $put-color;
}

&.options {
background-position: 4px -148px;
background-color: $options-color;
}

&.patch {
background-position: 4px -114px;
background-color: $patch-color;
}

&.delete {
background-position: 4px -44px;
background-color: $delete-color;
}

&.basic {
background-position: 5px -79px;
background-color: $basic-color;
}

&.link {
background-position: 4px -131px;
background-color: $link-color;
}
}
}

/* global redoc styles */

@for $index from 1 through 5 {
Expand Down
5 changes: 3 additions & 2 deletions lib/components/Search/redoc-search.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@
<input #search (keyup)="update($event, search.value)" [value]="searchTerm" placeholder="Search">
</div>
<ul class="search-results" [hidden]="!items.length">
<li class="result" *ngFor="let item of items"
<li class="result menu-item-header" *ngFor="let item of items"
ngClass="menu-item-depth-{{item.menuItem.depth}} {{item.menuItem.ready ? '' : 'disabled'}}"
(click)="clickSearch(item)">
{{item.menuItem.name}}
<span class="operation-type" [ngClass]="item.menuItem?.metadata?.operation" *ngIf="item.menuItem?.metadata?.operation"> {{item.menuItem?.metadata?.operation}} </span><!--
--><span class="menu-item-title">{{item.menuItem.name}}</span>
</li>
</ul>
1 change: 1 addition & 0 deletions lib/components/Search/redoc-search.scss
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ input {
overflow-y: auto;
border-bottom: 1px solid darken($side-bar-bg-color, 10%);
border-top: 1px solid darken($side-bar-bg-color, 10%);
line-height: 1.2;

min-height: 150px;
max-height: 250px;
Expand Down
4 changes: 2 additions & 2 deletions lib/components/SideMenu/side-menu-items.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<li *ngFor="let item of items; let idx = index" class="menu-item"
ngClass="menu-item-depth-{{item.depth}} {{item.active ? 'active' : ''}} menu-item-for-{{item.metadata?.type}}">
<label class="menu-item-header" [ngClass]="{disabled: !item.ready}" (click)="activateItem(item)">
<span class="operation-type" [ngClass]="item?.metadata?.operation" *ngIf="item?.metadata?.operation"> {{item?.metadata?.operation}} </span>
{{item.name}}
<span class="operation-type" [ngClass]="item?.metadata?.operation" *ngIf="item?.metadata?.operation"> {{item?.metadata?.operation}} </span><!--
--><span class="menu-item-title">{{item.name}}</span>
</label>
<ul *ngIf="item.items" class="menu-subitems" [@itemAnimation]="(item.active || item.isGroup) ? 'expanded' : 'collapsed'">
<side-menu-items [items]="item.items" (activate)="activateItem($event)"> </side-menu-items>
Expand Down
57 changes: 1 addition & 56 deletions lib/components/SideMenu/side-menu-items.scss
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@

.menu-item-depth-2 {
> .menu-item-header {
padding-left: 2*$side-menu-item-hpadding;
padding-left: $side-menu-item-hpadding;
}

> .menu-item-header:hover,
Expand Down Expand Up @@ -108,58 +108,3 @@
//background: none;
}
}

.menu-item-header > .operation-type {
width: 26px;
display: inline-block;
height: 13px;
background-color: #333;
border-radius: 3px;
vertical-align: middle;
background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABMAAACgCAYAAADuDlcXAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyRpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRw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2HhIM4YGq0a4oDgiGjYTKw20/OwUzAEuXz73YSqtdsV+F1a3eZpweFEGGG7Y3ULbJRk4nYPlEHbUi86wpNtbz4oB37PICOrLEdC9DKzFv7EkQ8tYY8Nr8tuyJrRsdpMrIJ0n4GPBmGEEUbYzRMKnFwug1B7rppmbCiyBjBrQ1vC8KW/CxrF7osNrRbxMjofWsIIuwU2vapnZfTRq4/wFXl3hG9bMzP6ZWV47LoB+Gym1/EyUleKI2GEPW8pQpu80bHLvsifSWFVAVEzo2VDTxxb9T16eO7sF0vmxPNPxPFHgAEA/rGUMXq/uWcAAAAASUVORK5CYII=');
background-repeat: no-repeat;
background-position: 6px 4px;
text-indent: -9000px;
margin-right: 7px;
margin-top: -3px;

&.get {
background-position: 8px -12px;
background-color: $get-color;
}

&.post {
background-position: 6px 4px;
background-color: $post-color;
}

&.put {
background-position: 8px -28px;
background-color: $put-color;
}

&.options {
background-position: 4px -148px;
background-color: $options-color;
}

&.patch {
background-position: 4px -114px;
background-color: $patch-color;
}

&.delete {
background-position: 4px -44px;
background-color: $delete-color;
}

&.basic {
background-position: 5px -79px;
background-color: $basic-color;
}

&.link {
background-position: 4px -131px;
background-color: $link-color;
}
}

0 comments on commit 61fd426

Please sign in to comment.