Skip to content

Commit

Permalink
fix some view styles
Browse files Browse the repository at this point in the history
  • Loading branch information
sprocketc committed Nov 29, 2024
1 parent a766036 commit 4444533
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 19 deletions.
3 changes: 2 additions & 1 deletion src/renderer/app/views.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,8 @@
[:span "or"]

[:> Select/Root
{:onValueChange #(rf/dispatch [::document.e/new-from-template (get paper-size %)])}
{:onValueChange #(rf/dispatch [::document.e/new-from-template
(get paper-size %)])}
[:> Select/Trigger
{:class "button px-2 overlay rounded"
:aria-label "Select size"}
Expand Down
24 changes: 13 additions & 11 deletions src/renderer/attribute/views.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -83,13 +83,14 @@
(defn form-input
[k v {:keys [disabled placeholder] :as attrs}]
[:div.relative.flex.form-input.flex-1
[:input (merge attrs
{:key v
:id (name k)
:default-value v
:placeholder (if v placeholder "multiple")
:on-blur #(on-change-handler! % k v)
:on-key-down #(keyb/input-key-down-handler! % v on-change-handler! k v)})]
[:input
(merge attrs
{:key v
:id (name k)
:default-value v
:placeholder (if v placeholder "multiple")
:on-blur #(on-change-handler! % k v)
:on-key-down #(keyb/input-key-down-handler! % v on-change-handler! k v)})]
(when-not (or (empty? (str v)) disabled)
[:button.button.bg-primary.text-muted.absolute.h-full.right-0.clear-input-button.hover:bg-transparent.invisible.p-1
{:on-pointer-down #(rf/dispatch [::element.e/remove-attr k])}
Expand All @@ -110,10 +111,11 @@
(when (= (.-target e) (.-activeElement js/document))
(rf/dispatch [::e/update-and-focus k (if (pos? (.-deltaY e)) - +) step])))}]
[:div.px-1.w-full.bg-primary
[ui/slider (merge attrs
{:value [(if (= "" v) placeholder v)]
:on-value-change (fn [[v]] (rf/dispatch [::element.e/preview-attr k v]))
:on-value-commit (fn [[v]] (rf/dispatch [::element.e/set-attr k v]))})]]])
[ui/slider
(merge attrs
{:value [(if (= "" v) placeholder v)]
:on-value-change (fn [[v]] (rf/dispatch [::element.e/preview-attr k v]))
:on-value-commit (fn [[v]] (rf/dispatch [::element.e/set-attr k v]))})]]])

(defn select-input
[k v {:keys [disabled items default-value] :as attrs}]
Expand Down
5 changes: 3 additions & 2 deletions src/renderer/document/views.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,9 @@
[:div.flex.drag.justify-between
[:div.flex.flex-1.gap-px.overflow-hidden
(for [document-id tabs]
^{:key (str document-id)}
[tab document-id (:title (get documents document-id)) (= document-id active-id)])]
(let [title (:title (get documents document-id))
is-active (= document-id active-id)]
^{:key (str document-id)} [tab document-id title is-active]))]
[:div.toolbar
[:> DropdownMenu/Root
[:> DropdownMenu/Trigger
Expand Down
3 changes: 2 additions & 1 deletion src/renderer/tool/events.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
::drag-event
(fn [{:keys [db]} [_ {:keys [data-transfer pointer-pos] :as e}]]
(when (= (:type e) "drop")
{::fx/drop [(frame.h/adjusted-pointer-pos db pointer-pos) data-transfer]})))
(let [position (frame.h/adjusted-pointer-pos db pointer-pos)]
{::fx/drop [position data-transfer]}))))

(rf/reg-event-db
::keyboard-event
Expand Down
6 changes: 2 additions & 4 deletions src/renderer/toolbar/views.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,8 @@
[:> Tooltip/Trigger
{:as-child true}
[:span.shadow-4
[ui/icon-button
icon
{:disabled disabled
:on-click #(rf/dispatch action)}]]]
[ui/icon-button icon {:disabled disabled
:on-click #(rf/dispatch action)}]]]
[:> Tooltip/Portal
[:> Tooltip/Content
{:class "tooltip-content"
Expand Down

0 comments on commit 4444533

Please sign in to comment.