mirror of
https://github.com/penpot/penpot.git
synced 2025-12-11 22:14:05 +01:00
Highlight invalid token values
This commit is contained in:
@@ -20,10 +20,14 @@
|
|||||||
(mf/defc token-pill
|
(mf/defc token-pill
|
||||||
{::mf/wrap-props false}
|
{::mf/wrap-props false}
|
||||||
[{:keys [on-click token highlighted?]}]
|
[{:keys [on-click token highlighted?]}]
|
||||||
(let [{:keys [name value]} token]
|
(let [{:keys [name value]} token
|
||||||
|
resolved-value (try
|
||||||
|
(wtc/resolve-token-value token)
|
||||||
|
(catch js/Error _ nil))]
|
||||||
[:div {:class (stl/css-case :token-pill true
|
[:div {:class (stl/css-case :token-pill true
|
||||||
:token-pill-highlighted highlighted?)
|
:token-pill-highlighted highlighted?
|
||||||
:title (str "Token value: " value)
|
:token-pill-invalid (not resolved-value))
|
||||||
|
:title (str (if resolved-value "Token value: " "Invalid token value: ") value)
|
||||||
:on-click on-click}
|
:on-click on-click}
|
||||||
name]))
|
name]))
|
||||||
|
|
||||||
|
|||||||
@@ -27,4 +27,9 @@
|
|||||||
color: var(--button-primary-foreground-color-rest);
|
color: var(--button-primary-foreground-color-rest);
|
||||||
background: var(--button-primary-background-color-rest);
|
background: var(--button-primary-background-color-rest);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&.token-pill-invalid {
|
||||||
|
color: var(--status-color-error-500);
|
||||||
|
opacity: 0.8;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user