Просмотр исходного кода

remove proptypes and change tag name

yuto-o 4 лет назад
Родитель
Сommit
7c9a37e0c2
1 измененных файлов с 3 добавлено и 10 удалено
  1. 3 10
      packages/app/src/components/TagCloudBox.tsx

+ 3 - 10
packages/app/src/components/TagCloudBox.tsx

@@ -1,16 +1,15 @@
 import React, { FC } from 'react';
-import PropTypes from 'prop-types';
 
 import { TagCloud } from 'react-tagcloud';
 
-type Tags = {
+type Tag = {
   _id: string,
   name: string,
   count: number,
 }
 
 type Props = {
-  tags:Tags[],
+  tags:Tag[],
   minSize?: number,
   maxSize?: number,
 }
@@ -29,17 +28,11 @@ const TagCloudBox: FC<Props> = (props:Props) => {
         })}
         style={{ cursor: 'pointer' }}
         className="simple-cloud"
-        onClick={(target) => { window.location.href = `/_search?q=tag:${target.value}` }}
+        onClick={(target) => { window.location.href = `/_search?q=tag:${encodeURIComponent(target.value)}` }}
       />
     </>
   );
 
 };
 
-TagCloudBox.propTypes = {
-  tags: PropTypes.array.isRequired,
-  minSize: PropTypes.number,
-  maxSize: PropTypes.number,
-};
-
 export default TagCloudBox;