Skip to content

Commit 057d521

Browse files
author
vivek ravichandran
committed
Model Level View
1 parent eb8af5f commit 057d521

6 files changed

Lines changed: 99 additions & 28 deletions

File tree

.gitignore

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# See https://help.github.com/ignore-files/ for more about ignoring files.
2+
3+
# dependencies
4+
/node_modules
5+
6+
# testing
7+
/coverage
8+
9+
# production
10+
/build
11+
12+
# misc
13+
.DS_Store
14+
.env.local
15+
.env.development.local
16+
.env.test.local
17+
.env.production.local
18+
19+
npm-debug.log*
20+
yarn-debug.log*
21+
yarn-error.log*

public/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
<!--
2929
BitCoin Live Status
3030
-->
31-
<div id="root" class="grid"></div>
31+
<!-- <div id="root" class="grid"></div> -->
3232
<div id="bitcoin" class="grid"></div>
3333
<!--
3434
This HTML file is a template.

src/App.css

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -22,22 +22,7 @@
2222
font-size: large;
2323
}
2424

25-
.head{
26-
font-size: 30px;
27-
font-weight: bold;
28-
}
29-
.table{
30-
padding:3px;
31-
border: 3px solid #fff;
32-
margin: 10px;
33-
}
34-
td{
35-
padding: 8px;
36-
}
37-
th{
38-
padding: 10px;
39-
border:2px solid #fff;
40-
}
25+
4126

4227
@keyframes App-logo-spin {
4328
from { transform: rotate(0deg); }

src/bitcoin/BitCoin.css

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
2+
.head{
3+
font-size: 30px;
4+
font-weight: bold;
5+
}
6+
.table{
7+
padding:3px;
8+
border: 3px solid #fff;
9+
margin: 10px;
10+
}
11+
td{
12+
padding: 8px;
13+
}
14+
th{
15+
padding: 10px;
16+
border:2px solid #fff;
17+
}

src/bitcoin/BitCoin.js

Lines changed: 55 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,28 +3,76 @@ import './BitCoin.css';
33

44
class BitCoin extends Component {
55

6+
67
constructor(){
78
super();
89
this.state = {
9-
'bitcoin':null
10+
result:[]
1011
};
1112
}
1213

1314
componentDidMount=()=>{
14-
// fetch('https://api.coindesk.com/v1/bpi/currentprice.json').then(customers=>{
15-
// console.log('Vivek');
16-
// console.log(customers.json());
17-
// // this.setState({'bitcoin':customers});
18-
// });
15+
fetch('https://api.coindesk.com/v1/bpi/currentprice.json').then(customers=>{
16+
return customers.json();
17+
}).then(data=>{
18+
this.setState({
19+
'updated_isodate':data.time.updatedISO,
20+
'disclaimer':data.disclaimer,
21+
'chartName':data.chartName,
22+
'usd_symbol':data.bpi.USD.code,
23+
'usd_desc':data.bpi.USD.description,
24+
'usd_rate':data.bpi.USD.rate_float,
25+
'eur_symbol':data.bpi.EUR.code,
26+
'eur_desc':data.bpi.EUR.description,
27+
'eur_rate':data.bpi.EUR.rate_float,
28+
'gbp_symbol':data.bpi.GBP.code,
29+
'gbp_desc':data.bpi.GBP.description,
30+
'gbp_rate':data.bpi.GBP.rate_float,
31+
});
32+
console.log("Vivek Java : "+JSON.stringify(data));
33+
},error=>{
34+
console.log("Vivek Error : "+JSON.stringify(error));
35+
});
1936
}
2037

2138
render() {
2239
return (
2340
<div className="bitcoin">
24-
VIvek
41+
<label className='head' >{this.state.chartName}</label><br/><hr/><br/>
42+
<label className='note' ><strong>Disclaimer :</strong> {this.state.disclaimer}</label><br/><br/>
43+
<center>
44+
<table border='1' className='table'>
45+
<thead>
46+
<tr>
47+
<th className='table-head'>Symbol</th>
48+
<th className='table-head'>Description</th>
49+
<th className='table-head'>Rate</th>
50+
</tr>
51+
</thead>
52+
<tbody>
53+
<tr>
54+
<td>{this.state.usd_symbol}</td>
55+
<td>{this.state.usd_desc}</td>
56+
<td>{this.state.usd_rate}</td>
57+
</tr>
58+
<tr>
59+
<td>{this.state.eur_symbol}</td>
60+
<td>{this.state.eur_desc}</td>
61+
<td>{this.state.eur_rate}</td>
62+
</tr>
63+
<tr>
64+
<td>{this.state.gbp_symbol}</td>
65+
<td>{this.state.gbp_desc}</td>
66+
<td>{this.state.gbp_rate}</td>
67+
</tr>
68+
</tbody>
69+
</table>
70+
</center>
71+
2572
</div>
2673
);
2774
}
2875
}
2976

77+
3078
export default BitCoin;

src/index.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import React from 'react';
22
import ReactDOM from 'react-dom';
33
import './index.css';
4-
import App from './App';
5-
//import BitCoin from './bitcoin/BitCoin';
4+
//import App from './App';
5+
import BitCoin from './bitcoin/BitCoin';
66
import registerServiceWorker from './registerServiceWorker';
77

8-
ReactDOM.render(<App />, document.getElementById('root'));
9-
//ReactDOM.render(<BitCoin />, document.getElementById('bitcoin'));
8+
//ReactDOM.render(<App />, document.getElementById('root'));
9+
ReactDOM.render(<BitCoin />, document.getElementById('bitcoin'));
1010
registerServiceWorker();

0 commit comments

Comments
 (0)