1
Fork 0
mirror of https://github.com/pds-nest/nest.git synced 2024-11-30 00:14:19 +00:00
pds-2021-g2-nest/nest_frontend/components/interactive/BoxWordcloud.js

34 lines
1,002 B
JavaScript
Raw Normal View History

2021-05-15 16:05:13 +00:00
import React from "react"
import BoxFull from "../base/BoxFull"
import ReactWordcloud from "react-wordcloud"
2021-05-16 21:14:28 +00:00
/**
* A Box which displays a wordcloud.
*
* @param words - A list of word objects, made of a string "text" and a number "value"
* @param props - Additional props to pass to the box.
* @returns {JSX.Element}
* @constructor
*/
export default function BoxWordcloud({ words, props }) {
2021-05-15 16:05:13 +00:00
return (
<BoxFull header={"Wordcloud"} {...props}>
<div style={{"width": "100%", "height": "100%"}}>
<ReactWordcloud
options={{
colors: [
"var(--fg-primary)",
],
fontFamily: "Bree Serif",
fontSizes: [12, 128],
size: undefined,
deterministic: true,
}}
2021-05-16 21:14:28 +00:00
words={words}
2021-05-15 16:05:13 +00:00
/>
</div>
</BoxFull>
)
}