Skip to content

Commit 2f1f262

Browse files
Add docs and update example
1 parent f41ef2a commit 2f1f262

4 files changed

Lines changed: 96 additions & 11456 deletions

File tree

README.md

Lines changed: 90 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,90 @@
1-
# react-crypto-icons
2-
Simple React component that displays 400+ cryptocurrency icons.
1+
# React Crypto Icons
2+
3+
## _A simple React component that can display 600 crypto icons_
4+
5+
[![Build Status](https://travis-ci.org/joemccann/dillinger.svg?branch=master)](https://travis-ci.org/joemccann/dillinger)
6+
7+
React Crypto Icons provides a simple icon component that can display crypto logos
8+
9+
## Dependencies
10+
11+
This library requires the following packages to be installed:
12+
13+
- [react][react] v17.0.2+
14+
- [react-dom ][react-dom] v17.0.2+
15+
16+
## Installation
17+
18+
React Crypto Icons requires [Node.js](https://nodejs.org/) v12+ to run.
19+
20+
Install React Crypto Icons from npm
21+
22+
```sh
23+
npm install react-crypto-icons
24+
```
25+
26+
Or with yarn
27+
28+
```sh
29+
yarn add react-crypto-icons
30+
```
31+
32+
## Icons
33+
34+
This project supports nearly 600 (okay 594) SVG icons taken from the [cryptocurrency-icons][cryptocurrency-icons] project.
35+
You can check out the supported icons [here](http://cryptoicons.co/)!
36+
37+
## Usage
38+
39+
All icon names should be lowercase to avoid capitalization mismatching. To ensure consistant icon sizing, you **MUST** specify a size for each icon.
40+
41+
```js
42+
import React from "react";
43+
import Icon from "react-crypto-icons";
44+
45+
function App() {
46+
return (
47+
<div className="App">
48+
<Icon name="btc" size={25} />
49+
</div>
50+
);
51+
}
52+
53+
export default App;
54+
```
55+
56+
_Pretty much all there is to it :)_
57+
58+
## Development
59+
60+
We love contributions 'round these parts!
61+
62+
React Crypto Icons is written in TypeScript and **will** be tested using jest.
63+
Make sure all new features are tested before creating PR.
64+
65+
If you are into making SVGs, head over to the [cryptocurrency-icons][cryptocurrency-icons] project. I am sure they would love the extra iconage.
66+
67+
Build:
68+
69+
```sh
70+
npm run build
71+
```
72+
73+
Run tests:
74+
75+
```sh
76+
npm run test
77+
```
78+
79+
## License
80+
81+
MIT
82+
83+
**Free Software, Yee Haw!**
84+
85+
[//]: # "These are reference links used in the body of this note and get stripped out when the markdown processor does its job. There is no need to format nicely because it shouldn't be seen. Thanks SO - http://stackoverflow.com/questions/4823468/store-comments-in-markdown-syntax"
86+
[react]: https://www.npmjs.com/package/react
87+
[react-dom]: https://www.npmjs.com/package/react-dom
88+
[cryptocurrency-icons]: https://www.npmjs.com/package/cryptocurrency-icons
89+
90+
[icons] <http://cryptoicons.co>

example/src/App.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
import React, { useState } from "react";
1+
import React from "react";
22
import Icon from "react-crypto-icons";
33
import "./App.css";
44

55
function App() {
6-
const [icon, setIcon] = useState<string>("btc");
6+
const [icon, setIcon] = React.useState<string>("btc");
77
return (
88
<div className="App">
99
<h1>React Crypto Icons</h1>
10-
<h2>Search icon from 400+ cryptos!</h2>
10+
<h2>Search icon from 600 cryptos!</h2>
1111
<div className="Input-container">
1212
<input
1313
type="text"
@@ -16,11 +16,11 @@ function App() {
1616
onChange={(e: any) => setIcon(e.target.value)}
1717
/>
1818
</div>
19-
<Icon name={icon} height={300} width={300} />
19+
<Icon name={icon} size={300} />
2020
<h5 className="footer-container">
2121
*When a symbol's icon is not found, the generic icon{" "}
2222
<div className="footer-icon">
23-
<Icon name="generic" height={1.5} width={1.5} />
23+
<Icon name="generic" size={1.5} />
2424
</div>{" "}
2525
is returned
2626
</h5>

0 commit comments

Comments
 (0)