-
Notifications
You must be signed in to change notification settings - Fork 31
Expand file tree
/
Copy pathsimple-cloud.js
More file actions
43 lines (40 loc) · 1.16 KB
/
simple-cloud.js
File metadata and controls
43 lines (40 loc) · 1.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import React from 'react'
import { TagCloud } from 'react-tagcloud'
const data = [
{ value: 'jQuery', count: 25 },
{ value: 'MongoDB', count: 18 },
{ value: 'JavaScript', count: 38 },
{ value: 'React', count: 30 },
{ value: 'Nodejs', count: 28 },
{ value: 'Express.js', count: 25 },
{ value: 'HTML5', count: 33 },
{ value: 'CSS3', count: 20 },
{ value: 'Webpack', count: 22 },
{ value: 'Babel.js', count: 7 },
{ value: 'ECMAScript', count: 25 },
{ value: 'Jest', count: 15 },
{ value: 'Mocha', count: 17 },
{ value: 'React Native', count: 27 },
{ value: 'Angular.js', count: 30 },
{ value: 'TypeScript', count: 15 },
{ value: 'Flow', count: 30 },
{ value: 'NPM', count: 11 },
]
/* CSS:
.simple-cloud .tag-cloud-tag {
cursor: pointer;
}
*/
// minSize, maxSize - font size in px
// tags - array of objects with properties value and count
// shuffle - indicates if data should be shuffled (true by default)
// onClick event handler has `tag` and `event` parameter
export default () => (
<TagCloud
minSize={12}
maxSize={35}
tags={data}
className="simple-cloud"
onClick={(tag) => alert(`'${tag.value}' was selected!`)}
/>
)