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

Update traffic lights to get window state from state (WIP)

MrWillCom 3 лет назад
Родитель
Сommit
151fc24e81

+ 20 - 5
src/main/frontend/components/win32_title_bar.cljs

@@ -1,6 +1,7 @@
 (ns frontend.components.win32-title-bar
   (:require [rum.core :as rum]
-            [frontend.components.svg :as svg]))
+            [frontend.components.svg :as svg]
+            [frontend.state :as state]))
 
 (rum/defc container
   []
@@ -17,11 +18,25 @@
     [:div.right-side
       {}
       [:div.minimize
-        {}
+        {:on-click ()}
         (svg/chrome-minimize)]
       [:div.max-restore
-        {}
-        (svg/chrome-maximize)]
+        {:on-click ()}
+        (if (state/sub :win32-title-bar/window-is-maximized?)
+          (svg/chrome-restore)
+          (svg/chrome-maximize))]
       [:div.close
-        {}
+        {:on-click ()}
         (svg/chrome-close)]]])
+
+(defn minimize
+  []
+  ())
+
+(defn max-restore
+  []
+  ())
+
+(defn close
+  []
+  ())

+ 2 - 1
src/main/frontend/components/win32_title_bar.css

@@ -1,5 +1,5 @@
 .cp__win32-title-bar {
-  z-index: 100;
+  z-index: var(--ls-z-index-level-5);
   position: fixed;
   left: 0;
   right: 0;
@@ -32,6 +32,7 @@
     -webkit-app-region: no-drag;
 
     > * {
+      color: var(--ls-link-text-color);
       width: 100%;
       display: flex;
       justify-content: center;

+ 4 - 0
src/main/frontend/state.cljs

@@ -278,6 +278,10 @@
      :whiteboard/last-persisted-at          {}
      :whiteboard/pending-tx-data            {}
      :history/page-only-mode?               false
+
+     ;; win32 title bar
+     ;; TODO: get window info from ipc
+     :win32-title-bar/window-is-maximized?  false
      ;; db tx-id -> editor cursor
      :history/tx->editor-cursor             {}})))