mirror of
https://github.com/penpot/penpot.git
synced 2025-06-22 23:46:58 +02:00
✨ Limit the amount of fills shown in the UI
This commit is contained in:
parent
f33c1fb530
commit
ce23fee292
1 changed files with 8 additions and 3 deletions
|
@ -54,9 +54,14 @@
|
||||||
|
|
||||||
;; Excluding nil values
|
;; Excluding nil values
|
||||||
values (d/without-nils values)
|
values (d/without-nils values)
|
||||||
fills (:fills values)
|
fills (if (contains? cfg/flags :frontend-binary-fills)
|
||||||
|
(take shp/MAX-FILLS (d/nilv (:fills values) []))
|
||||||
|
(:fills values))
|
||||||
has-fills? (or (= :multiple fills) (some? (seq fills)))
|
has-fills? (or (= :multiple fills) (some? (seq fills)))
|
||||||
can-add-fills? (and (contains? cfg/flags :frontend-binary-fills) (not (= :multiple fills)) (< (count fills) shp/MAX-FILLS))
|
can-add-fills? (if (contains? cfg/flags :frontend-binary-fills)
|
||||||
|
(and (not (= :multiple fills))
|
||||||
|
(< (count fills) shp/MAX-FILLS))
|
||||||
|
(not (= :multiple fills)))
|
||||||
|
|
||||||
state* (mf/use-state has-fills?)
|
state* (mf/use-state has-fills?)
|
||||||
open? (deref state*)
|
open? (deref state*)
|
||||||
|
@ -170,7 +175,7 @@
|
||||||
|
|
||||||
(seq fills)
|
(seq fills)
|
||||||
[:& h/sortable-container {}
|
[:& h/sortable-container {}
|
||||||
(for [[index value] (d/enumerate (:fills values []))]
|
(for [[index value] (d/enumerate fills)]
|
||||||
[:> color-row* {:color (ctc/fill->shape-color value)
|
[:> color-row* {:color (ctc/fill->shape-color value)
|
||||||
:key index
|
:key index
|
||||||
:index index
|
:index index
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue