/
SOFG1
/
generic
Обзор
Документация
Войти
/
SOFG1
/
generic
Код
Запросы
0
Задачи
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
src/components/SentimentorComponents/CloudComponent.tsx
34 строки
895 B
Eddy
initial commit
22 июл 2024, 17:06
22 июл 2024, 17:06
a72fa2b
Код
Авторство
О чём код?
import React, {useMemo} from 'react' import ReactWordcloud from "react-wordcloud"; // We moved WordCLoud into a separate memoized component in order to prevent redraws on select/deselect tags const CloudComponent = React.memo(({ tags, onClick }: any) => { const callbacks = useMemo(() => { return { getWordColor: (tag: any) => tag.color, getWordTooltip: () => "", onWordClick: (tag: any) => { //Don't pass other properties only text and color onClick({text: tag.text, color: tag.color}); }, } }, [onClick]) return ( <ReactWordcloud callbacks={callbacks} words={tags} options={{ rotationAngles: [0, 0], rotations: 0, padding: 5, fontSizes: [30, 60], fontWeight: "600", }} /> ); }); export default CloudComponent;