Skip to content

Commit

Permalink
feat(tabs): add bottom area, tab url as optional
Browse files Browse the repository at this point in the history
  • Loading branch information
marcjulian committed May 2, 2020
1 parent afca714 commit 9afb648
Show file tree
Hide file tree
Showing 10 changed files with 36 additions and 14 deletions.
2 changes: 1 addition & 1 deletion projects/components/src/lib/footer/footer.component.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<footer class="w-full max-w-screen-xl mx-auto text-white p-2">
<footer class="w-full max-w-screen-xl mx-auto text-white p-5">
<div class="md:grid md:grid-cols-2">
<div class="p-4">
<p class="text-sm text-color-light">about</p>
Expand Down
11 changes: 6 additions & 5 deletions projects/components/src/lib/tab/tab.component.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<div class="flex justify-center items-center xs:flex-1 md:flex md:h-24 md:flex-none" [ngClass]="'logo'"
[class.xs:hidden]="tab.hideOnMobile" [class.md:hidden]="tab.hideOnDesktop">
<a class="flex flex-col items-center hover:text-blue" [class.hover:text-color]="tab.logo" [routerLink]="tab.url"
[routerLinkActive]="tab.routeActive ? 'active-tab' : ''">
<niz-inline-svg class="h-10 w-10" [svgSource]="tab.image"></niz-inline-svg>
<div
class="flex justify-center items-center xs:flex-1 md:flex md:h-24 md:flex-none hover:text-blue hover:bg-blue-opacity-10 focus:outline-none"
[ngClass]="'logo'" [class.xs:hidden]="tab.hideOnMobile" [class.md:hidden]="tab.hideOnDesktop"
[class.hover:text-color]="tab.logo" [routerLink]="tab.url">
<a class="flex flex-col items-center " [routerLinkActive]="tab.routeActive ? 'active-tab' : ''">
<niz-inline-svg class="h-8 w-8" [svgSource]="tab.image"></niz-inline-svg>
<span *ngIf="tab.text" class="mt-1 text-lg font-semibold tracking-tight">{{tab.text}}</span>
</a>
</div>
3 changes: 3 additions & 0 deletions projects/components/src/lib/tabs/tabs.component.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
<nav
class="fixed flex bg-tabs z-10 xs:flex-row xs:bottom-0 xs:h-20 xs:w-screen md:flex-col md:top-0 md:h-screen md:w-20">
<niz-tab *ngFor="let tab of tabs" [tab]="tab"></niz-tab>
<div class="flex flex-1 md:flex-grow flex-col-reverse">
<ng-content select="[bottom]"></ng-content>
</div>
</nav>
<div class="w-full min-h-screen xs:pb-20 md:pl-20 ">
<ng-content></ng-content>
Expand Down
4 changes: 2 additions & 2 deletions projects/components/src/lib/utils/symbols.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
export interface Tab {
url: string;
url?: string;
logo?: boolean;
text?: string;
routeActive: boolean;
routeActive?: boolean;
image: string;
hideOnMobile?: boolean;
hideOnDesktop?: boolean;
Expand Down
6 changes: 4 additions & 2 deletions src/app/app.component.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<niz-tabs [tabs]="tabs">
<niz-tab bottom [tab]="themeTab" (click)="bla()"></niz-tab>
<niz-toolbar>
<div start>
<a class="block focus:outline-none" [routerLink]="['/']">
Expand All @@ -16,9 +17,10 @@
</div>
</niz-toolbar>

<main class="w-full max-w-screen-xl mx-auto p-2">
<main class="w-full max-w-screen-xl mx-auto p-5">
<router-outlet></router-outlet>
</main>

<niz-footer [footerSections]="footerSections" [copyrightUrl]="copyrightUrl" [createdWithSvgSources]="createdWithSvgSources"></niz-footer>
<niz-footer [footerSections]="footerSections" [copyrightUrl]="copyrightUrl"
[createdWithSvgSources]="createdWithSvgSources"></niz-footer>
</niz-tabs>
8 changes: 8 additions & 0 deletions src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ export class AppComponent {
},
];

themeTab: Tab = {
image: 'assets/img/adjust.svg',
};

copyrightUrl = 'legal/privacy-policy';

createdWithSvgSources = [
Expand Down Expand Up @@ -94,4 +98,8 @@ export class AppComponent {
],
},
];

bla() {
console.log('click theme');
}
}
4 changes: 4 additions & 0 deletions src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import {
NizTabsModule,
NizToolbarModule,
NizFooterModule,
NizInlineSvgModule,
NizTabModule,
} from '@notiz/ngx-design';
import { AppRoutingModule } from './app-routing.module';

Expand All @@ -19,6 +21,8 @@ import { AppRoutingModule } from './app-routing.module';
NizTabsModule,
NizToolbarModule,
NizFooterModule,
NizInlineSvgModule,
NizTabModule,
],
providers: [],
bootstrap: [AppComponent],
Expand Down
4 changes: 4 additions & 0 deletions src/assets/img/adjust.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions src/assets/img/scully.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions src/assets/img/tailwindcss.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 9afb648

Please sign in to comment.