0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-02-01 20:09:04 -05:00

Merge pull request #5625 from penpot/eva-fix-long-token-names

This commit is contained in:
Andrey Antukh 2025-01-20 16:38:24 +01:00 committed by GitHub
commit 1395629e5a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 17 additions and 15 deletions

View file

@ -640,13 +640,15 @@
(let [path-split (split-path path)] (let [path-split (split-path path)]
(merge-path-item (first path-split) name))) (merge-path-item (first path-split) name)))
(defn split-string-half
"Split string in two halfs" (defn split-by-last-period
"Splits a string into two parts:
the text before and including the last period,
and the text after the last period."
[s] [s]
(let [len (count s) (if-let [last-period (str/last-index-of s ".")]
mid (quot len 2)] [(subs s 0 (inc last-period)) (subs s (inc last-period))]
[(subs s 0 mid) [s ""]))
(subs s mid)]))
(defn get-frame-objects (defn get-frame-objects
"Retrieves a new objects map only with the objects under frame-id (with frame-id)" "Retrieves a new objects map only with the objects under frame-id (with frame-id)"

View file

@ -21,7 +21,7 @@
color (when (seq (ctob/find-token-value-references value)) color (when (seq (ctob/find-token-value-references value))
(wtt/resolved-value-hex theme-token)) (wtt/resolved-value-hex theme-token))
contains-path? (str/includes? name ".") contains-path? (str/includes? name ".")
splitted-name (cfh/split-string-half name) splitted-name (cfh/split-by-last-period name)
color (or color (wtt/resolved-value-hex token)) color (or color (wtt/resolved-value-hex token))
on-click on-click
(mf/use-callback (mf/use-callback

View file

@ -62,22 +62,22 @@
.divided-name-wrapper { .divided-name-wrapper {
height: $s-16; height: $s-16;
display: flex;
align-items: center;
white-space: nowrap;
overflow: hidden;
} }
.first-name-wrapper { .first-name-wrapper {
display: inline-block;
max-width: 50%;
overflow: hidden; overflow: hidden;
white-space: pre;
text-overflow: ellipsis; text-overflow: ellipsis;
white-space: nowrap;
max-width: 100%;
} }
.last-name-wrapper { .last-name-wrapper {
display: inline-block; flex-shrink: 0;
max-width: 50%; margin-left: 4px;
overflow: hidden;
white-space: pre;
direction: rtl;
} }
.token-pill-applied { .token-pill-applied {