-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
169 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"compilerOptions": { | ||
"baseUrl": "src" | ||
}, | ||
"include": ["src"] | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,24 @@ | ||
import logo from './logo.svg'; | ||
import './App.css'; | ||
import React from 'react'; | ||
import TickerWidget from 'components/TickerWidget'; | ||
import ConverterWidget from 'components/ConverterWidget'; | ||
import ChartWidget from 'components/ChartWidget'; | ||
import MarqueeWidget from 'components/MarqueeWidget'; | ||
|
||
function App() { | ||
return ( | ||
<div className="App"> | ||
<header className="App-header"> | ||
<img src={logo} className="App-logo" alt="logo" /> | ||
<p> | ||
Edit <code>src/App.js</code> and save to reload. | ||
</p> | ||
<a | ||
className="App-link" | ||
href="https://reactjs.org" | ||
target="_blank" | ||
rel="noopener noreferrer" | ||
> | ||
Learn React | ||
</a> | ||
</header> | ||
const App = () => ( | ||
<div> | ||
<div style={{ width: '300px', height: '200px', border: '1px solid #ccc', padding: '10px' }}> | ||
<TickerWidget /> | ||
</div> | ||
); | ||
} | ||
<div style={{ width: '300px', height: '200px', border: '1px solid #ccc', padding: '10px' }}> | ||
<ConverterWidget /> | ||
</div> | ||
<div style={{ width: '300px', height: '200px', border: '1px solid #ccc', padding: '10px' }}> | ||
<ChartWidget /> | ||
</div> | ||
<div style={{ width: '300px', height: '200px', border: '1px solid #ccc', padding: '10px' }}> | ||
<MarqueeWidget /> | ||
</div> | ||
</div> | ||
); | ||
|
||
export default App; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// components/ChartWidget.js | ||
|
||
import React from 'react'; | ||
import useScript from 'utilities/useScript'; | ||
|
||
const ChartWidget = () => { | ||
|
||
useScript('https://widgets.coingecko.com/coingecko-coin-compare-chart-widget.js'); | ||
return ( | ||
<div> | ||
<coingecko-coin-compare-chart-widget coin-ids="bitcoin" currency="usd" locale="en"></coingecko-coin-compare-chart-widget> | ||
</div> | ||
); | ||
}; | ||
|
||
export default ChartWidget; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// components/ConverterWidget.js | ||
|
||
import React from 'react'; | ||
import useScript from 'utilities/useScript'; | ||
|
||
const ConverterWidget = () => { | ||
|
||
useScript('https://widgets.coingecko.com/coingecko-coin-converter-widget.js'); | ||
|
||
return ( | ||
<div> | ||
<coingecko-coin-converter-widget coin-id="bitcoin" currency="usd" background-color="#ffffff" font-color="#4c4c4c" locale="en"></coingecko-coin-converter-widget> | ||
</div> | ||
); | ||
}; | ||
|
||
export default ConverterWidget; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// components/MarqueeWidget.js | ||
|
||
import React from 'react'; | ||
import useScript from 'utilities/useScript'; | ||
|
||
const MarqueeWidget = () => { | ||
|
||
useScript('https://widgets.coingecko.com/coingecko-coin-price-marquee-widget.js'); | ||
return ( | ||
<div> | ||
<coingecko-coin-price-marquee-widget coin-ids="bitcoin,ethereum,eos,ripple,litecoin" currency="usd" background-color="#ffffff" locale="en"></coingecko-coin-price-marquee-widget> | ||
</div> | ||
); | ||
}; | ||
|
||
export default MarqueeWidget; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// components/TickerWidget.js | ||
|
||
import React from 'react'; | ||
import useScript from 'utilities/useScript'; | ||
|
||
const TickerWidget = () => { | ||
|
||
useScript('https://widgets.coingecko.com/coingecko-coin-ticker-widget.js'); | ||
|
||
return ( | ||
<div> | ||
<coingecko-coin-ticker-widget coin-id="bitcoin" currency="usd" locale="en" vce-ready></coingecko-coin-ticker-widget> | ||
</div> | ||
); | ||
}; | ||
|
||
export default TickerWidget; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// utilities/useScript.js | ||
import { useEffect } from 'react'; | ||
|
||
const useScript = url => { | ||
useEffect(() => { | ||
const script = document.createElement('script'); | ||
|
||
script.src = url; | ||
script.async = true; | ||
|
||
document.body.appendChild(script); | ||
|
||
return () => { | ||
document.body.removeChild(script); | ||
}; | ||
}, [url]); | ||
}; | ||
|
||
export default useScript; |