فهرست منبع

allow switching the watching state.

Shun Miyazawa 4 سال پیش
والد
کامیت
dccb60da0d
1فایلهای تغییر یافته به همراه2 افزوده شده و 2 حذف شده
  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>