ソースを参照

playing around with components

Rachelle 6 年 前
コミット
70ab0afb5f

+ 26
- 6
MyPassionProjectClient/src/pages/friends/friends.html ファイルの表示

@@ -1,9 +1,3 @@
1
-<!--
2
-  Generated template for the FriendsPage page.
3
-
4
-  See http://ionicframework.com/docs/components/#navigation for more info on
5
-  Ionic pages and navigation.
6
--->
7 1
 <ion-header>
8 2
 
9 3
   <ion-navbar>
@@ -20,4 +14,30 @@
20 14
 
21 15
 <ion-content padding>
22 16
 
17
+  <ion-searchbar></ion-searchbar>
18
+  <ion-list>
19
+    <ion-item-sliding>
20
+      <ion-item>
21
+        <ion-thumbnail item-start>
22
+          <img src="img/thumbnail-totoro.png">
23
+        </ion-thumbnail>
24
+        <h2>SpiderMango</h2>
25
+        <p>Nafear</p>
26
+        <button ion-button clear item-end>View</button>
27
+      </ion-item>
28
+
29
+      <ion-item-options side="left">
30
+        <button ion-button color="primary" (click)="viewFriendDetails()">
31
+          <ion-icon></ion-icon> View
32
+        </button>
33
+      </ion-item-options>
34
+
35
+      <ion-item-options side="right">
36
+        <button ion-button color="secondary" (click)="addToFriendList()">
37
+          <ion-icon></ion-icon> Add
38
+        </button>
39
+      </ion-item-options>
40
+    </ion-item-sliding>
41
+  </ion-list>
42
+
23 43
 </ion-content>

+ 12
- 4
MyPassionProjectClient/src/pages/friends/friends.ts ファイルの表示

@@ -1,5 +1,5 @@
1 1
 import { Component } from '@angular/core';
2
-import { IonicPage, NavController, NavParams } from 'ionic-angular';
2
+import {IonicPage, NavController, NavParams, ToastController} from 'ionic-angular';
3 3
 
4 4
 /**
5 5
  * Generated class for the FriendsPage page.
@@ -15,11 +15,19 @@ import { IonicPage, NavController, NavParams } from 'ionic-angular';
15 15
 })
16 16
 export class FriendsPage {
17 17
 
18
-  constructor(public navCtrl: NavController, public navParams: NavParams) {
18
+  constructor(public navCtrl: NavController, public navParams: NavParams, public toastCtrl: ToastController) {
19 19
   }
20 20
 
21
-  ionViewDidLoad() {
22
-    console.log('ionViewDidLoad FriendsPage');
21
+  addToFriendList() {
22
+    let toast = this.toastCtrl.create({
23
+      message: 'Friend Request Sent!',
24
+      duration: 3000,
25
+      position: 'bottom'
26
+    });
27
+    toast.present();
28
+
23 29
   }
24 30
 
31
+  viewFriendDetails() {}
32
+
25 33
 }

+ 7
- 8
MyPassionProjectClient/src/pages/games/games.html ファイルの表示

@@ -1,9 +1,3 @@
1
-<!--
2
-  Generated template for the GamesPage page.
3
-
4
-  See http://ionicframework.com/docs/components/#navigation for more info on
5
-  Ionic pages and navigation.
6
--->
7 1
 <ion-header>
8 2
   <ion-navbar>
9 3
     <ion-buttons start>
@@ -17,8 +11,9 @@
17 11
 
18 12
 
19 13
 <ion-content padding>
20
-  <ion-list>
21 14
 
15
+  <ion-searchbar (ionInput)="getItems($event)"></ion-searchbar>
16
+  <ion-list>
22 17
     <ion-item-sliding>
23 18
       <ion-item>
24 19
       <ion-thumbnail item-start>
@@ -29,6 +24,11 @@
29 24
       <button ion-button clear item-end>View</button>
30 25
         </ion-item>
31 26
 
27
+      <ion-item-options side="left">
28
+        <button ion-button color="primary" (click)="doAddToOwnedAndPlayedList()">
29
+          <ion-icon name="add"></ion-icon> Owned and Played
30
+        </button>
31
+      </ion-item-options>
32 32
 
33 33
       <ion-item-options side="right">
34 34
       <button ion-button color="primary" (click)="doAddToOwnedList()">
@@ -39,6 +39,5 @@
39 39
         </button>
40 40
       </ion-item-options>
41 41
     </ion-item-sliding>
42
-
43 42
   </ion-list>
44 43
 </ion-content>

+ 39
- 2
MyPassionProjectClient/src/pages/games/games.ts ファイルの表示

@@ -14,13 +14,16 @@ import {IonicPage, NavController, NavParams, ToastController} from 'ionic-angula
14 14
   templateUrl: 'games.html',
15 15
 })
16 16
 export class GamesPage {
17
+  searchQuery: string = '';
18
+  items: string[];
17 19
 
18 20
   constructor(public navCtrl: NavController, public navParams: NavParams, public toastCtrl: ToastController,) {
21
+    this.initializeItems();
19 22
   }
20 23
 
21 24
   doAddToOwnedList() {
22 25
       let toast = this.toastCtrl.create({
23
-        message: 'Game Added To Owned List',
26
+        message: 'Game Added To MyGames',
24 27
         duration: 3000,
25 28
         position: 'bottom'
26 29
       });
@@ -30,7 +33,7 @@ export class GamesPage {
30 33
 
31 34
   doAddToPlayedList() {
32 35
     let toast = this.toastCtrl.create({
33
-      message: 'Game Added To Played List',
36
+      message: 'Game Added To PlayedGames',
34 37
       duration: 3000,
35 38
       position: 'bottom'
36 39
     });
@@ -38,4 +41,38 @@ export class GamesPage {
38 41
 
39 42
   }
40 43
 
44
+  doAddToOwnedAndPlayedList() {
45
+    let toast = this.toastCtrl.create({
46
+      message: 'Game Added To MyPlayedGames',
47
+      duration: 3000,
48
+      position: 'bottom'
49
+    });
50
+    toast.present();
51
+
52
+  }
53
+
54
+  initializeItems() {
55
+    this.items = [
56
+      'Agricola',
57
+      'Catan',
58
+      'Magic'
59
+    ];
60
+  }
61
+
62
+  getItems(ev: any) {
63
+    // Reset items back to all of the items
64
+    this.initializeItems();
65
+
66
+    // set val to the value of the searchbar
67
+    const val = ev.target.value;
68
+
69
+    // if the value is an empty string don't filter the items
70
+    if (val && val.trim() != '') {
71
+      this.items = this.items.filter((item) => {
72
+        return (item.toLowerCase().indexOf(val.toLowerCase()) > -1);
73
+      })
74
+    }
75
+  }
76
+
77
+
41 78
 }

+ 53
- 0
MyPassionProjectClient/src/pages/profile/profile.html ファイルの表示

@@ -19,5 +19,58 @@
19 19
 
20 20
 
21 21
 <ion-content padding>
22
+  <ion-card>
22 23
 
24
+    <ion-card-header>
25
+      <strong>My Profile</strong>
26
+    </ion-card-header>
27
+
28
+    <img src="img/nin-live.png"/>
29
+
30
+    <ion-card-content>
31
+      <ion-card-title>
32
+        Xomi
33
+      </ion-card-title>
34
+      <p>
35
+        Always up for a good strategy game! Currently obsessed with Dominion.
36
+      </p>
37
+    </ion-card-content>
38
+
39
+  </ion-card>
40
+
41
+  <ion-card>
42
+
43
+    <ion-card-header>
44
+      <strong>My Games</strong>
45
+    </ion-card-header>
46
+
47
+    <ion-card-content>
48
+      <ion-card-title>
49
+        Descent
50
+      </ion-card-title>
51
+      <p>
52
+        Cooperative, Character-Building
53
+      </p>
54
+
55
+      <ion-card-title>
56
+        Dominion
57
+      </ion-card-title>
58
+      <p>
59
+        Deck-Builder, Strategy
60
+      </p>
61
+
62
+      <ion-card-title>
63
+        SushiGo
64
+      </ion-card-title>
65
+      <p>
66
+        Pass the Trash, New-Player Friendly
67
+      </p>
68
+    </ion-card-content>
69
+
70
+  </ion-card>
23 71
 </ion-content>
72
+
73
+
74
+
75
+
76
+