🐛 Show a component's annotation in the Inspect styles view

The annotation of a main component or a copy only showed in the
Computed view of the Inspect tab; the Styles view, the default one in
the workspace and in View mode, never rendered it.

The Styles view now shows the annotation, above the exports, as the
Computed view does.

Found by the components Qase run (PENPOT-1428, PENPOT-1429,
PENPOT-1618).

Checked in the browser: selecting an annotated main component shows
its annotation in Inspect > Styles.

AI-assisted-by: claude-opus-5-5
This commit is contained in:
alonso.torres 2026-11-19 10:09:38 +01:00
parent 3837ee5ff5
commit 8ed11dcf26
2 changed files with 7 additions and 0 deletions

View File

@ -16,6 +16,7 @@
[app.common.types.tokens-lib :as ctob]
[app.main.data.style-dictionary :as sd]
[app.main.refs :as refs]
[app.main.ui.inspect.annotation :refer [annotation*]]
[app.main.ui.inspect.exports :as exports]
[app.main.ui.inspect.styles.panels.blur :refer [blur-panel*]]
[app.main.ui.inspect.styles.panels.fill :refer [fill-panel*]]
@ -110,6 +111,8 @@
first-component (ctkl/get-component data (:component-id first-shape))
shape-type (get-shape-type shapes first-shape first-component)
panels (type->panel-group shape-type)
annotation-content (when (= (count shapes) 1)
(ctkl/get-component-annotation first-shape libraries))
tokens-lib (mf/deref refs/tokens-lib)
tokens-status (mf/deref refs/tokens-status)
@ -279,6 +282,9 @@
;; DEFAULT WIP
[:> style-box* {:panel panel}
[:div color-space]])])]
(when annotation-content
[:div {:class (stl/css :annotation-wrapper)}
[:> annotation* {:content annotation-content}]])
[:div {:class (stl/css :exports-wrapper)}
[:& exports/exports
{:shapes shapes

View File

@ -14,6 +14,7 @@
block-size: calc(100vh - px2rem(180)); // TODO: Fix this hardcoded value
}
.annotation-wrapper,
.exports-wrapper {
padding-block: var(--sp-s);
padding-inline: var(--sp-m);