Skip to content

Commit 3deb907

Browse files
authored
Merge pull request #5 from SoftStackFactory/00-hotfixes
fix(ui): Updating layout
2 parents 2423521 + f46ec99 commit 3deb907

5 files changed

Lines changed: 97 additions & 20 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"build": "ionic-app-scripts build --prod",
1212
"lint": "ionic-app-scripts lint",
1313
"ionic:build": "ionic-app-scripts build",
14-
"ionic:serve": "ionic-app-scripts serve --no-devapp --no-open --port 3000"
14+
"ionic:serve": "ionic-app-scripts serve --no-devapp --no-open --port 3000 --address localhost"
1515
},
1616
"dependencies": {
1717
"@angular/animations": "5.2.11",

src/app/app.component.ts

Lines changed: 28 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,42 @@
1-
import { Component } from '@angular/core';
2-
import { Platform } from 'ionic-angular';
1+
import { Component, ViewChild } from '@angular/core';
2+
import { Nav, Platform } from 'ionic-angular';
33
import { StatusBar } from '@ionic-native/status-bar';
44
import { SplashScreen } from '@ionic-native/splash-screen';
55

66
import { HomePage } from '../pages/home/home';
7+
78
@Component({
89
templateUrl: 'app.html'
910
})
1011
export class MyApp {
11-
rootPage:any = HomePage;
12+
@ViewChild(Nav) nav: Nav;
13+
14+
rootPage: any = HomePage;
15+
16+
pages: Array<{title: string, component: any}>;
17+
18+
constructor(public platform: Platform, public statusBar: StatusBar, public splashScreen: SplashScreen) {
19+
this.initializeApp();
20+
21+
// used for an example of ngFor and navigation
22+
this.pages = [
23+
{ title: 'Home', component: HomePage }
24+
];
1225

13-
constructor(platform: Platform, statusBar: StatusBar, splashScreen: SplashScreen) {
14-
platform.ready().then(() => {
26+
}
27+
28+
initializeApp() {
29+
this.platform.ready().then(() => {
1530
// Okay, so the platform is ready and our plugins are available.
1631
// Here you can do any higher level native things you might need.
17-
statusBar.styleDefault();
18-
splashScreen.hide();
32+
this.statusBar.styleDefault();
33+
this.splashScreen.hide();
1934
});
2035
}
21-
}
2236

37+
openPage(page) {
38+
// Reset the content nav to have just this page
39+
// we wouldn't want the back button to show in this scenario
40+
this.nav.setRoot(page.component);
41+
}
42+
}

src/app/app.html

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,19 @@
1-
<ion-nav [root]="rootPage"></ion-nav>
1+
<ion-menu [content]="content">
2+
<ion-header>
3+
<ion-toolbar>
4+
<ion-title>Menu</ion-title>
5+
</ion-toolbar>
6+
</ion-header>
7+
8+
<ion-content>
9+
<ion-list>
10+
<button menuClose ion-item *ngFor="let p of pages" (click)="openPage(p)">
11+
{{p.title}}
12+
</button>
13+
</ion-list>
14+
</ion-content>
15+
16+
</ion-menu>
17+
18+
<!-- Disable swipe-to-go-back because it's poor UX to combine STGB with side menus -->
19+
<ion-nav [root]="rootPage" #content swipeBackEnabled="false"></ion-nav>

src/pages/home/home.html

Lines changed: 46 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,53 @@
11
<ion-header>
22
<ion-navbar>
3-
<ion-title>
4-
Ionic Blank
5-
</ion-title>
3+
<button ion-button menuToggle>
4+
<ion-icon name="menu"></ion-icon>
5+
</button>
6+
<ion-title>Home</ion-title>
67
</ion-navbar>
78
</ion-header>
89

910
<ion-content padding>
10-
The world is your oyster.
11-
<p>
12-
If you get lost, the <a href="http://ionicframework.com/docs/v2">docs</a> will be your guide.
13-
</p>
11+
12+
<ion-grid fixed>
13+
14+
<ion-row>
15+
<ion-col>
16+
<ion-card>
17+
<ion-card-header>Ionic Starter</ion-card-header>
18+
<ion-card-content>If you get lost, the <a href="http://ionicframework.com/docs/v2">docs</a> will show you the
19+
way.</ion-card-content>
20+
</ion-card>
21+
</ion-col>
22+
</ion-row>
23+
24+
<ion-row>
25+
<ion-col>
26+
<ion-card>
27+
<ion-card-header>First Column</ion-card-header>
28+
<ion-card-content>Content</ion-card-content>
29+
</ion-card>
30+
</ion-col>
31+
</ion-row>
32+
33+
<ion-row>
34+
<ion-col>
35+
<ion-card>
36+
<ion-card-header>Second Column</ion-card-header>
37+
<ion-card-content>Content</ion-card-content>
38+
</ion-card>
39+
</ion-col>
40+
</ion-row>
41+
42+
<ion-row>
43+
<ion-col>
44+
<ion-card>
45+
<ion-card-header>Third Column</ion-card-header>
46+
<ion-card-content>Content</ion-card-content>
47+
</ion-card>
48+
</ion-col>
49+
</ion-row>
50+
51+
</ion-grid>
52+
1453
</ion-content>

src/pages/home/home.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
import { Component } from '@angular/core';
2-
import { NavController } from 'ionic-angular';
2+
import { NavController, MenuController } from 'ionic-angular';
33

44
@Component({
55
selector: 'page-home',
66
templateUrl: 'home.html'
77
})
88
export class HomePage {
99

10-
constructor(public navCtrl: NavController) {
11-
10+
constructor(public navCtrl: NavController, menu: MenuController) {
11+
menu.enable(true);
1212
}
1313

1414
}

0 commit comments

Comments
 (0)