Explorar el Código

allow switching the watching state.

Shun Miyazawa hace 4 años
padre
commit
dccb60da0d
Se han modificado 1 ficheros con 2 adiciones y 2 borrados
  1. 2 2
      packages/app/src/components/WatchButton.jsx

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

@@ -9,7 +9,7 @@ const WatchButton = (props) => {
   const [isWatching, setIsWatching] = useState(true);
 
   const handleClick = () => {
-    console.log('watch button clicked!');
+    setIsWatching(!isWatching);
   };
 
   return (
@@ -18,7 +18,7 @@ const WatchButton = (props) => {
         type="button"
         id="bookmark-button"
         onClick={handleClick}
-        className={`btn btn-bookmark border-0 ${`btn-${props.size}`}`}
+        className={`btn btn-bookmark border-0 ${`btn-${props.size}`} ${isWatching ? 'active' : ''}`}
       >
         {isWatching && (
           <i className="fa fa-eye"></i>