Skip to content

Commit

Permalink
feat(tabset): add style incapsulation for tabset components (#911)
Browse files Browse the repository at this point in the history
Closes #561
  • Loading branch information
lexzhukov authored and nnixaa committed Oct 23, 2018
1 parent 995de58 commit 33162af
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@
nb-theme(scrollbar-bg),
nb-theme(scrollbar-width));

ul {
.route-tabset {
font-family: nb-theme(route-tabs-font-family);
font-size: nb-theme(route-tabs-font-size);

padding: 0 nb-theme(route-tabs-padding);
border-bottom: 1px solid nb-theme(route-tabs-separator);

li {
.route-tab {
background: nb-theme(route-tabs-header-bg);
min-width: nb-theme(route-tabs-header-min-width);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@

@import '../../styles/core/mixins';

ul {
.route-tabset {
display: flex;
flex-direction: row;
list-style-type: none;
margin: 0;

li {
.route-tab {
cursor: pointer;
margin-bottom: -1px;
text-align: center;
Expand Down Expand Up @@ -50,6 +50,6 @@ ul {
}
}

:host.full-width ul {
:host.full-width .route-tabset {
justify-content: space-around;
}
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,14 @@ import { convertToBoolProperty } from '../helpers';
selector: 'nb-route-tabset',
styleUrls: ['./route-tabset.component.scss'],
template: `
<ul>
<ul class="route-tabset">
<li *ngFor="let tab of tabs"
(click)="$event.preventDefault(); selectTab(tab)"
routerLink="{{tab.route}}"
routerLinkActive="active"
[routerLinkActiveOptions]="{ exact: true }"
[class.responsive]="tab.responsive">
[class.responsive]="tab.responsive"
class="route-tab">
<a href>
<i *ngIf="tab.icon" [class]="tab.icon"></i>
<span *ngIf="tab.title">{{ tab.title }}</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@
nb-theme(scrollbar-bg),
nb-theme(scrollbar-width));

ul {
.tabset {
font-family: nb-theme(tabs-font-family);
font-size: nb-theme(tabs-font-size);

padding: 0 nb-theme(tabs-padding);
border-bottom: 1px solid nb-theme(tabs-separator);

li {
.tab {
background: nb-theme(tabs-header-bg);

a {
Expand Down
7 changes: 4 additions & 3 deletions src/framework/theme/components/tabset/tabset.component.scss
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
display: block;


&.full-width ul {
&.full-width .tabset {
justify-content: space-around;
}

Expand All @@ -23,13 +23,14 @@
display: block;
}
}
ul {

.tabset {
display: flex;
flex-direction: row;
list-style-type: none;
margin: 0;

li {
.tab {
cursor: pointer;
margin-bottom: -1px;
text-align: center;
Expand Down
5 changes: 3 additions & 2 deletions src/framework/theme/components/tabset/tabset.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -196,11 +196,12 @@ export class NbTabComponent {
selector: 'nb-tabset',
styleUrls: ['./tabset.component.scss'],
template: `
<ul>
<ul class="tabset">
<li *ngFor="let tab of tabs"
(click)="selectTab(tab)"
[class.responsive]="tab.responsive"
[class.active]="tab.active">
[class.active]="tab.active"
class="tab">
<a href (click)="$event.preventDefault()">
<i *ngIf="tab.tabIcon" [class]="tab.tabIcon"></i>
<span *ngIf="tab.tabTitle">{{ tab.tabTitle }}</span>
Expand Down

0 comments on commit 33162af

Please sign in to comment.