From b46b8a6b95a620b669dc3ecd33fd5cf5179cced7 Mon Sep 17 00:00:00 2001
From: madelinegr <monika_hedman@brown.edu>
Date: Fri, 7 Jun 2019 15:37:34 -0400
Subject: SHE WORKS YEET

---
 src/client/views/SearchBox.tsx | 74 +++++++++++++++++++++++++-----------------
 1 file changed, 45 insertions(+), 29 deletions(-)

(limited to 'src/client/views/SearchBox.tsx')

diff --git a/src/client/views/SearchBox.tsx b/src/client/views/SearchBox.tsx
index 3aaf3decb..7d2d8e547 100644
--- a/src/client/views/SearchBox.tsx
+++ b/src/client/views/SearchBox.tsx
@@ -45,12 +45,14 @@ export interface ToggleBarProps {
 export class ToggleBar extends React.Component<ToggleBarProps>{
 
     @observable _status: boolean = false;
-    @observable timeline: any;
+    @observable timeline: anime.AnimeTimelineInstance;
     @observable _toggleButton: React.RefObject<HTMLDivElement>;
 
     constructor(props: ToggleBarProps) {
         super(props);
         this._toggleButton = React.createRef();
+        this.timeline = anime.timeline({autoplay: false,
+        direction: "reverse"});
     }
 
     componentDidMount = () => {
@@ -65,48 +67,62 @@ export class ToggleBar extends React.Component<ToggleBarProps>{
         }
         let totalWidth = (barwidth - togwidth - 10);
 
-        this.timeline = anime.timeline({
-            autoplay: false,
-            loop: false,
-            direction: "normal"
-        });
+        // this.timeline = anime.timeline({
+        //     autoplay: false,
+        //     loop: false,
+        //     direction: "normal",
+        //     complete:(anim: anime.AnimeInstance) => {
+        //         anim.pause();
+        //         console.log("finished!")
+        //     }
+        // });
+
+        // let test = anime({
+        //     targets: "",
+        //     opacity: 1
+        // })
 
         this.timeline.add({
             targets: this._toggleButton.current,
+            // autoplay: false,
+            loop: false,
+            // direction: "normal",
             translateX: totalWidth,
             easing: "easeInOutQuad",
         });
     }
-
+    
     @action.bound
     onclick() {
         console.log("clicked")
         this._status = !this._status;
-        if(this._status){
-            console.log("playing normally")
-            this.timeline.play()
-        }
-        else{
-            console.log("playing reverse")
-            this.timeline.play();
-            this.timeline.reverse();
-            this.timeline.pause();
-        }
+        this.timeline.play();
+        this.timeline.reverse();
+        // if(this._status){
+        //     console.log("playing normally")
+        //     this.timeline.play()
+        // }
+        // else{
+        //     console.log("playing reverse")
+        //     this.timeline.reverse();
+        //     // this.timeline.pause()
+        //     // this.timeline.pause();
+        // }
 
     }
 
-    @action.bound
-    toggle = (animation: any, open: boolean) => {
-        if(open){
-            animation.play();
-            if(animation.reversed) {
-                animation.reverse();
-            }
-        } else{
-            animation.play();
-
-        }
-    }
+    // @action.bound
+    // toggle = (animation: any, open: boolean) => {
+    //     if(open){
+    //         animation.play();
+    //         if(animation.reversed) {
+    //             animation.reverse();
+    //         }
+    //     } else{
+    //         animation.play();
+
+    //     }
+    // }
 
     render() {
         return (
-- 
cgit v1.2.3-70-g09d2

