Add support for horizontal tabs into cor-tabs

This commit is contained in:
Joseph Schorr 2017-05-08 16:46:46 -04:00
parent 191e5d94d4
commit ea13469d9d
13 changed files with 116 additions and 20 deletions

View file

@ -1,4 +1,4 @@
cor-tabs { .vertical cor-tabs {
display: table-cell; display: table-cell;
float: none; float: none;
vertical-align: top; vertical-align: top;
@ -6,6 +6,43 @@ cor-tabs {
border-right: 1px solid #DDE7ED; border-right: 1px solid #DDE7ED;
} }
@media (min-width: 768px) {
.horizontal-label {
color: #666;
}
.vertical .horizontal-label {
display: none;
}
.horizontal .horizontal-label {
display: inline-block;
vertical-align: middle;
}
.horizontal .horizontal-label {
margin-left: 10px;
display: inline-block;
}
.horizontal .cor-tab-itself {
font-size: 18px;
padding: 6px;
padding-left: 10px;
padding-right: 10px;
}
.horizontal .cor-tab-itself i.fa {
color: #666;
font-size: 14px;
color: #ccc;
}
.horizontal .cor-tab-itself.active i.fa {
color: #666;
}
}
.co-tab-container { .co-tab-container {
padding: 0px; padding: 0px;
} }
@ -18,7 +55,14 @@ cor-tabs {
vertical-align: top; vertical-align: top;
} }
.co-tab-content { .horizontal .co-tab-content {
width: 100%;
display: block;
float: none;
padding: 30px;
}
.vertical .co-tab-content {
width: 100%; width: 100%;
display: table-cell; display: table-cell;
float: none; float: none;
@ -68,6 +112,10 @@ cor-tabs {
} }
@media (max-width: 767px) { @media (max-width: 767px) {
.vertical cor-tabs {
display: block;
}
.co-tabs { .co-tabs {
display: block; display: block;
width: auto; width: auto;
@ -78,6 +126,16 @@ cor-tabs {
cor-tabs { cor-tabs {
position: relative; position: relative;
display: block; display: block;
float: none;
vertical-align: top;
background-color: #e8f1f6;
border-right: 1px solid #DDE7ED;
}
.co-tab-element li.active {
background-color: white;
border-right: 1px solid white;
margin-right: -1px;
} }
.co-tab-element .xs-toggle { .co-tab-element .xs-toggle {
@ -106,24 +164,46 @@ cor-tabs {
font-family: FontAwesome; font-family: FontAwesome;
} }
.co-tab-element .xs-label { .co-tab-element .horizontal-label {
line-height: 60px;
font-size: 16px; font-size: 16px;
margin-left: 16px; margin-left: 16px;
display: inline-block !important; display: inline-block !important;
color: gray; color: gray;
vertical-align: middle;
} }
.co-tabs li a { .cor-tab-itself {
width: 100%;
}
.cor-tab-icon {
vertical-align: middle;
}
.co-top-tab-bar {
padding: 0px;
}
.co-top-tab-bar li {
padding: 0px;
}
.co-tabs li a, .co-top-tab-bar li a {
display: inline-block; display: inline-block;
height: 60px; height: 60px;
line-height: 60px; line-height: 54px;
white-space: nowrap; white-space: nowrap;
width: 100%; width: 100%;
text-align: left; text-align: left;
padding-left: 20px; padding-left: 20px;
text-decoration: none !important; text-decoration: none !important;
font-size: 28px; font-size: 28px;
color: #666;
}
.co-top-tab {
display: block !important;
border-bottom: 0px !important;
} }
.co-tabs li a i { .co-tabs li a i {
@ -131,7 +211,7 @@ cor-tabs {
font-size: 28px; font-size: 28px;
} }
.co-tabs li.active a .xs-label { .co-tabs li.active a .horizontal-label {
color: black; color: black;
} }
@ -145,6 +225,7 @@ cor-tabs {
.co-tab-element.closed li { .co-tab-element.closed li {
height: 0px; height: 0px;
padding: 0px;
overflow: hidden; overflow: hidden;
} }

View file

@ -6,7 +6,7 @@
<div class="cor-loader"></div> <div class="cor-loader"></div>
</div> </div>
<div class="co-tab-modal-body" ng-show="!credentials.loading"> <div class="co-tab-modal-body" ng-show="!credentials.loading">
<cor-tab-panel remember-cookie="quay.credentialsTab"> <cor-tab-panel remember-cookie="quay.credentialsTab" vertical-tabs="true">
<!-- Tabs --> <!-- Tabs -->
<cor-tabs> <cor-tabs>
<cor-tab tab-active="true" tab-id="cred-secret-{{ ::dialogID }}"> <cor-tab tab-active="true" tab-id="cred-secret-{{ ::dialogID }}">

View file

@ -1,3 +1,3 @@
<div class="co-main-content-panel co-tab-panel co-fx-box-shadow-heavy"> <div class="co-main-content-panel co-tab-panel co-fx-box-shadow-heavy">
<div class="co-tab-container" ng-transclude></div> <div class="co-tab-container" ng-class="$ctrl.isVertical() ? 'vertical': 'horizontal'" ng-transclude></div>
</div> </div>

View file

@ -18,6 +18,9 @@ export class CorTabPanelComponent implements OnDestroy {
// If 'true', the currently selected tab will be remembered via a cookie and not the page URL. // If 'true', the currently selected tab will be remembered via a cookie and not the page URL.
@Input('@') public rememberCookie: string; @Input('@') public rememberCookie: string;
// If 'true', the tabs will be displayed vertically, as opposed to horizontally.
@Input('@') public verticalTabs: string;
// The tabs under this tabs component. // The tabs under this tabs component.
private tabs: CorTabComponent[] = []; private tabs: CorTabComponent[] = [];
@ -45,6 +48,13 @@ export class CorTabPanelComponent implements OnDestroy {
} }
} }
/**
* isVertical returns true if the tabs in this panel are displayed vertically.
*/
public isVertical(): boolean {
return this.verticalTabs == 'true';
}
public tabClicked(tab: CorTabComponent): void { public tabClicked(tab: CorTabComponent): void {
this.setActiveTab(tab); this.setActiveTab(tab);
} }

View file

@ -1,10 +1,11 @@
<li ng-class="{'active': $ctrl.isActive}"> <li class="cor-tab-itself" ng-class="{'active': $ctrl.isActive, 'co-top-tab': !$ctrl.parent.isVertical()}">
<a ng-click="$ctrl.tabClicked()"> <a ng-click="$ctrl.tabClicked()">
<span data-title="{{ ::$ctrl.tabTitle }}" <span class="cor-tab-icon"
data-title="{{ ::($ctrl.parent.isVertical() ? $ctrl.tabTitle : '') }}"
data-placement="right" data-placement="right"
data-container="body" data-container="body"
style="display: inline-block" style="display: inline-block"
bs-tooltip><span ng-transclude/></span><span class="visible-xs-inline xs-label">{{ ::$ctrl.tabTitle }}</span> bs-tooltip><span ng-transclude/></span><span class="horizontal-label">{{ ::$ctrl.tabTitle }}</span>
</span> </span>
</a> </a>
</li> </li>

View file

@ -1,4 +1,4 @@
<span class="co-tab-element" ng-class="$ctrl.isClosed ? 'closed' : 'open'"> <span class="co-tab-element" ng-class="$ctrl.isClosed ? 'closed' : 'open'">
<span class="xs-toggle" ng-click="$ctrl.toggleClosed($event)"></span> <span class="xs-toggle" ng-click="$ctrl.toggleClosed($event)"></span>
<ul class="co-tabs col-md-1" ng-transclude></ul> <ul ng-class="$ctrl.parent.isVertical() ? 'co-tabs col-md-1' : 'co-top-tab-bar'" ng-transclude></ul>
</span> </span>

View file

@ -1,5 +1,6 @@
import { Component, Host, Inject } from 'ng-metadata/core'; import { Component, Input, Output, Inject, EventEmitter, Host } from 'ng-metadata/core';
import { CorTabComponent } from './cor-tab.component'; import { CorTabComponent } from './cor-tab.component';
import { CorTabPanelComponent } from './cor-tab-panel.component';
/** /**
@ -16,6 +17,9 @@ export class CorTabsComponent {
// If true, the tabs are in a closed state. Only applies in the mobile view. // If true, the tabs are in a closed state. Only applies in the mobile view.
private isClosed: boolean = true; private isClosed: boolean = true;
constructor(@Host() @Inject(CorTabPanelComponent) private parent: CorTabPanelComponent) {
}
private toggleClosed(e): void { private toggleClosed(e): void {
this.isClosed = !this.isClosed; this.isClosed = !this.isClosed;
} }

View file

@ -15,7 +15,7 @@
</span> </span>
</div> </div>
<cor-tab-panel> <cor-tab-panel vertical-tabs="true">
<cor-tabs> <cor-tabs>
<cor-tab tab-title="Layers" tab-id="layers"> <cor-tab tab-title="Layers" tab-id="layers">
<i class="fa ci-layers"></i> <i class="fa ci-layers"></i>

View file

@ -20,7 +20,7 @@
</div> </div>
</div> </div>
<cor-tab-panel> <cor-tab-panel vertical-tabs="true">
<cor-tabs> <cor-tabs>
<cor-tab tab-title="Settings" tab-id="settings"> <cor-tab tab-title="Settings" tab-id="settings">
<i class="fa fa-gear"></i> <i class="fa fa-gear"></i>

View file

@ -20,7 +20,7 @@
<div class="repo-list-view padded" namespaces="[organization]">&nbsp;</div> <div class="repo-list-view padded" namespaces="[organization]">&nbsp;</div>
</div> </div>
<cor-tab-panel ng-if="!user.anonymous && isMember"> <cor-tab-panel ng-if="!user.anonymous && isMember" vertical-tabs="true">
<cor-tabs quay-show="isMember"> <cor-tabs quay-show="isMember">
<cor-tab tab-active="true" tab-title="Repositories" tab-id="repos"> <cor-tab tab-active="true" tab-title="Repositories" tab-id="repos">
<i class="fa fa-hdd-o"></i> <i class="fa fa-hdd-o"></i>

View file

@ -35,7 +35,7 @@
</span> </span>
</div> </div>
<cor-tab-panel> <cor-tab-panel vertical-tabs="true">
<cor-tabs> <cor-tabs>
<cor-tab tab-title="Information" tab-id="info" <cor-tab tab-title="Information" tab-id="info"
tab-init="showInfo()"> tab-init="showInfo()">

View file

@ -22,7 +22,7 @@
<span class="cor-title-content">Quay Enterprise Management</span> <span class="cor-title-content">Quay Enterprise Management</span>
</div> </div>
<cor-tab-panel> <cor-tab-panel vertical-tabs="true">
<cor-tabs> <cor-tabs>
<cor-tab tab-title="Manage Users" <cor-tab tab-title="Manage Users"
tab-id="users" tab-init="loadUsers()"> tab-id="users" tab-init="loadUsers()">

View file

@ -20,7 +20,7 @@
<div class="repo-list-view padded" namespaces="[context.viewuser]">&nbsp;</div> <div class="repo-list-view padded" namespaces="[context.viewuser]">&nbsp;</div>
</div> </div>
<cor-tab-panel ng-if="context.viewuser.is_me"> <cor-tab-panel ng-if="context.viewuser.is_me" vertical-tabs="true">
<cor-tabs quay-show="context.viewuser.is_me"> <cor-tabs quay-show="context.viewuser.is_me">
<cor-tab tab-active="true" tab-title="Repositories" tab-id="repos"> <cor-tab tab-active="true" tab-title="Repositories" tab-id="repos">
<i class="fa fa-hdd-o"></i> <i class="fa fa-hdd-o"></i>