Skip to content

Commit 5e8b774

Browse files
committed
refactor(list): enhance code style
1 parent 142b6b6 commit 5e8b774

File tree

6 files changed

+61
-42
lines changed

6 files changed

+61
-42
lines changed

src/pages/list/crypto-list/crypto-list.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
</ion-header>
66
<div class="welcome-header">
77
<div class="content">
8-
<div class="title">Cyrpto Currencies</div>
8+
<div class="title">Crypto Currencies</div>
99
<div class="subtitle">Find The latest info about Crypto currencies</div>
1010
</div>
1111
<button ion-fab color="dark" class="refresh"><ion-icon name="md-refresh"></ion-icon></button>

src/pages/list/crypto-list/crypto-list.scss

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,83 +1,99 @@
11
page-crypto-list {
22
.page-background{
3-
background-color: #36455F;
3+
background-color: rgb(89, 138, 223);
44
}
5+
56
p{
67
margin:0;
78
}
9+
810
.welcome-header{
911
position: relative;
1012
background: linear-gradient(135deg, #8B7FE0, #F75F9D);
1113
width:100%;
1214
padding: 30px 0;
1315
margin-bottom: 20px;
16+
1417
.refresh {
1518
position: absolute;
1619
right: 10px;
1720
background-color: #4c5b79;
1821
box-shadow: 0px 0px 5px #5b6a89;
1922
}
23+
2024
.content {
2125
text-align: center;
2226
padding: 20px;
2327
color:white;
28+
2429
img {
2530
width: 100px;
2631
margin-bottom: 10px;
2732
}
33+
2834
.title {
2935
font-size:20px;
3036
font-weight: 700;
3137
text-transform: uppercase;
3238
margin-bottom: 10px;
3339
}
40+
3441
.subtitle {
3542
font-size: 15px;
3643
font-weight: 400;
3744
text-align: center;
3845
}
3946
}
4047
}
48+
4149
.body {
4250
.currencies {
4351
.currency {
4452
background: linear-gradient(45deg, #5e6d8c, #384662);
4553
padding: 10px;
4654
border-radius: 10px;
4755
margin: 10px auto;
56+
4857
.image {
4958
text-align: left;
59+
5060
img {
5161
width: 50px;
5262
margin: 0;
5363
display: block;
5464
}
5565
}
66+
5667
.text {
5768
.name {
5869
color: #BCC6D4;
5970
font-size: 15px;
6071
font-weight: 700;
6172
}
73+
6274
.rank {
6375
color: #8b9bbd;
6476
font-size: 15px;
6577
font-weight: 500;
6678
}
79+
6780
.usd{
6881
color: #BCC6D4;
6982
font-size: 15px;
7083
font-weight: 700;
7184
}
85+
7286
.evolution{
7387
color:#00CB78;
88+
7489
.red{
7590
color: #F44447;
7691
}
7792
font-size: 16px;
7893
font-weight: 500;
7994
}
8095
}
96+
8197
.indicator {
8298
position: absolute;
8399
top: 50%;
@@ -88,5 +104,4 @@ page-crypto-list {
88104
}
89105
}
90106
}
91-
92107
}

src/pages/list/crypto-list/crypto-list.ts

Lines changed: 36 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -9,55 +9,56 @@ import { IonicPage, NavController, NavParams } from 'ionic-angular';
99
export class CryptoListPage {
1010
data = [
1111
{
12-
"id": "bitcoin",
13-
"name": "Bitcoin",
14-
"symbol": "btc",
15-
"rank": "1",
16-
"price_usd": "13208.8",
17-
"percent_change_1h": "1.54"
12+
id: 'bitcoin',
13+
name: 'Bitcoin',
14+
symbol: 'btc',
15+
rank: '1',
16+
price_usd: '13208.8',
17+
percent_change_1h: '1.54'
1818
},
1919
{
20-
"id": "ethereum",
21-
"name": "Ethereum",
22-
"symbol": "eth",
23-
"rank": "2",
24-
"price_usd": "658.926",
25-
"percent_change_1h": "2.42"
20+
id: 'ethereum',
21+
name: 'Ethereum',
22+
symbol: 'eth',
23+
rank: '2',
24+
price_usd: '658.926',
25+
percent_change_1h: '2.42'
2626
},
2727
{
28-
"id": "bitcoin-cash",
29-
"name": "Bitcoin Cash",
30-
"symbol": "bch",
31-
"rank": "3",
32-
"price_usd": "2758.51",
33-
"percent_change_1h": "2.65"
28+
id: 'bitcoin-cash',
29+
name: 'Bitcoin Cash',
30+
symbol: 'bch',
31+
rank: '3',
32+
price_usd: '2758.51',
33+
percent_change_1h: '2.65'
3434
},
3535
{
36-
"id": "ripple",
37-
"name": "Ripple",
38-
"symbol": "xrp",
39-
"rank": "4",
40-
"price_usd": "1.01963",
41-
"percent_change_1h": "0.98"
36+
id: 'ripple',
37+
name: 'Ripple',
38+
symbol: 'xrp',
39+
rank: '4',
40+
price_usd: '1.01963',
41+
percent_change_1h: '0.98'
4242
},
4343
{
44-
"id": "litecoin",
45-
"name": "Litecoin",
46-
"symbol": "ltc",
47-
"rank": "5",
48-
"price_usd": "263.913",
49-
"percent_change_1h": "2.21"
44+
id: 'litecoin',
45+
name: 'Litecoin',
46+
symbol: 'ltc',
47+
rank: '5',
48+
price_usd: '263.913',
49+
percent_change_1h: '2.21'
5050
}
5151
];
5252

53-
constructor(public navCtrl: NavController, public navParams: NavParams) {
54-
}
53+
constructor(public navCtrl: NavController, public navParams: NavParams) {}
5554

56-
precision(n,m){
55+
precision(n,m) {
5756
return parseFloat(n).toFixed(m);
5857
}
5958

60-
evolution(n){
61-
return n>0 ? '<span>'+parseFloat(n).toFixed(2)+'&nbsp;<i class="fa fa-caret-up"></i></span>' : '<span class="red">'+parseFloat(n).toFixed(2)+'&nbsp;<i class="fa fa-caret-down"></i></span>';
59+
evolution(n) {
60+
return n > 0
61+
? '<span>' + parseFloat(n).toFixed(2) + '&nbsp;<i class="fa fa-caret-up"></i></span>'
62+
: '<span class="red">' + parseFloat(n).toFixed(2) + '&nbsp;<i class="fa fa-caret-down"></i></span>';
6263
}
6364
}

src/pages/list/users/users.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<ion-list no-lines>
88
<ion-item *ngFor="let user of users">
99
<ion-avatar item-start>
10-
<img src="assets/img/misc/img-icon.png">
10+
<img src="assets/img/avatar/ian-avatar.png">
1111
</ion-avatar>
1212
<h2>John Doe</h2>
1313
<p> Lorem ipsum dolor sit amet consectetur adipisicing elit. Magnam sint consectetur, neque cum porro iste aperiam eveniet, corporis earum error similique. Cupiditate consequuntur autem doloribus nihil totam quibusdam aliquid omnis? </p>

src/pages/list/users/users.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
page-users {
22
.item-md,.item-ios {
33
padding-left:0px;
4+
45
ion-avatar img {
56
width:55px;
67
height:55px;
78
}
9+
810
ion-avatar[item-start]{
911
margin: 0px 30px 8px 0;
1012
}
13+
1114
.number-circle{
1215
color:white;
1316
font-weight: 700;
@@ -18,6 +21,7 @@ page-users {
1821
text-align: center;
1922
}
2023
}
24+
2125
.rating {
2226
ion-icon {
2327
font-size: 15px;

src/pages/list/users/users.ts

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

4-
54
@IonicPage()
65
@Component({
76
selector: 'page-users',
87
templateUrl: 'users.html',
98
})
109
export class UsersPage {
1110
users = new Array(10);
11+
1212
constructor(
1313
public navCtrl: NavController,
14-
public navParams: NavParams ) {
15-
14+
public navParams: NavParams) {
1615
}
1716

1817
}

0 commit comments

Comments
 (0)