From 5b2ffaee3a369b555ae982abf9712d445d6efee5 Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Sun, 16 May 2021 23:14:28 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A7=20Modularize=20the=20wordcloud?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/interactive/BoxWordcloud.js | 29 +++++++------------ 1 file changed, 10 insertions(+), 19 deletions(-) diff --git a/nest_frontend/components/interactive/BoxWordcloud.js b/nest_frontend/components/interactive/BoxWordcloud.js index 1185e72..93809a6 100644 --- a/nest_frontend/components/interactive/BoxWordcloud.js +++ b/nest_frontend/components/interactive/BoxWordcloud.js @@ -3,7 +3,15 @@ import BoxFull from "../base/BoxFull" import ReactWordcloud from "react-wordcloud" -export default function BoxWordcloud({ ...props }) { +/** + * 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 }) { return (
@@ -17,24 +25,7 @@ export default function BoxWordcloud({ ...props }) { size: undefined, deterministic: true, }} - words={[ - { - text: "noi", - value: 1 - }, - { - text: "estraiamo", - value: 1 - }, - { - text: "statistiche", - value: 1 - }, - { - text: "tweet", - value: 1 - }, - ]} + words={words} />