🐛 Fix sidebar width in localhost (#6732)

This commit is contained in:
Alonso Torres 2025-06-19 15:31:27 +02:00 committed by Andrey Antukh
parent 16a1fd14e5
commit accd5226d7
2 changed files with 8 additions and 4 deletions

View File

@ -15,6 +15,9 @@
(def grid-x-axis 10) (def grid-x-axis 10)
(def grid-y-axis 10) (def grid-y-axis 10)
(def sidebar-default-width 318)
(def sidebar-default-max-width 768)
(def page-metadata (def page-metadata
"Default data for page metadata." "Default data for page metadata."
{:grid-x-axis grid-x-axis {:grid-x-axis grid-x-axis

View File

@ -8,6 +8,7 @@
(:require-macros [app.main.style :as stl]) (:require-macros [app.main.style :as stl])
(:require (:require
[app.common.data.macros :as dm] [app.common.data.macros :as dm]
[app.main.constants :refer [sidebar-default-width sidebar-default-max-width]]
[app.main.data.common :as dcm] [app.main.data.common :as dcm]
[app.main.data.event :as ev] [app.main.data.event :as ev]
[app.main.data.workspace :as dw] [app.main.data.workspace :as dw]
@ -210,7 +211,7 @@
(= current-section :code))) (= current-section :code)))
{:keys [on-pointer-down on-lost-pointer-capture on-pointer-move set-size size]} {:keys [on-pointer-down on-lost-pointer-capture on-pointer-move set-size size]}
(use-resize-hook :code 276 276 768 :x true :right) (use-resize-hook :code sidebar-default-width sidebar-default-width sidebar-default-max-width :x true :right)
on-change-section on-change-section
(mf/use-fn (mf/use-fn
@ -224,7 +225,7 @@
(mf/use-fn (mf/use-fn
(mf/deps size) (mf/deps size)
(fn [] (fn []
(set-size (if (> size 276) 276 768)))) (set-size (if (> size sidebar-default-width) sidebar-default-width sidebar-default-max-width))))
props props
(mf/spread-props props (mf/spread-props props
@ -235,12 +236,12 @@
[:aside [:aside
{:class (stl/css-case :right-settings-bar true {:class (stl/css-case :right-settings-bar true
:not-expand (not can-be-expanded?) :not-expand (not can-be-expanded?)
:expanded (> size 276)) :expanded (> size sidebar-default-width))
:id "right-sidebar-aside" :id "right-sidebar-aside"
:data-testid "right-sidebar" :data-testid "right-sidebar"
:data-size (str size) :data-size (str size)
:style {"--width" (if can-be-expanded? (dm/str size "px") "276px")}} :style {"--width" (if can-be-expanded? (dm/str size "px") (dm/str sidebar-default-width "px"))}}
(when can-be-expanded? (when can-be-expanded?
[:div {:class (stl/css :resize-area) [:div {:class (stl/css :resize-area)