Parcourir la source

add watching state

Shun Miyazawa il y a 4 ans
Parent
commit
b6b18d6ceb
1 fichiers modifiés avec 10 ajouts et 2 suppressions
  1. 10 2
      packages/app/src/components/WatchButton.jsx

+ 10 - 2
packages/app/src/components/WatchButton.jsx

@@ -1,4 +1,4 @@
-import React from 'react';
+import React, { useState } from 'react';
 import PropTypes from 'prop-types';
 
 import { withTranslation } from 'react-i18next';
@@ -6,6 +6,8 @@ import { withTranslation } from 'react-i18next';
 
 const WatchButton = (props) => {
 
+  const [watching, setWatching] = useState(true);
+
   const handleClick = () => {
     console.log('watch button clicked!');
   };
@@ -18,7 +20,13 @@ const WatchButton = (props) => {
         onClick={handleClick}
         className={`btn btn-bookmark border-0 ${`btn-${props.size}`}`}
       >
-        <i className="fa fa-eye"></i>
+        {watching && (
+          <i className="fa fa-eye"></i>
+        )}
+
+        {!watching && (
+          <i className="fa fa-eye-slash"></i>
+        )}
       </button>
 
     </>