refactor: unify page-icon vertical alignment across all icon types

The page-title icon container used `.flex.self-start` and relied on each
icon type's own intrinsic baseline (font glyph for emoji, SVG bottom
anchor for tabler, etc.), with `margin-top: 8px` and `pb-[1.5px]`
band-aids compensating for one type at a time. Replaced with a single
flex-center 38×38 button rule, scoped to `.ls-page-title .ls-page-icon`,
so every type centers on the same visual axis. Drops the per-type pixel
overrides, the mobile-specific `:size 28` (mobile font is unchanged from
desktop, so the override was a band-aid), and the inline `1lh` style.
Bumps the icon-to-title gap from `gap-2` to `gap-3` (12px) for breathing
room.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
scheinriese
2026-04-27 23:33:21 +02:00
parent 154a0865c3
commit c2cf10e35d
3 changed files with 36 additions and 34 deletions

View File

@@ -3188,7 +3188,7 @@
(when (ldb/property? block)
{:type :tabler-icon
:id "letter-p"})))]
[:div.ls-page-icon.flex.self-start
[:div.ls-page-icon.flex.items-center
(icon-component/icon-picker icon
{:on-chosen (fn [_e icon]
(if icon
@@ -3222,18 +3222,12 @@
:page-title (:block/title block)
:preview-target-db-id (:db/id block)
:button-opts (when (:page-title? config)
;; Drop shui's default sizing/padding so the
;; CSS rule on .ls-page-title .ls-page-icon
;; button (38×38 flex-center) takes effect.
{:size nil
:class "!p-0.5 !h-auto !w-auto"})
:icon-props {:size (cond
(and (util/mobile?) (:page-title? config)) 28
(:page-title? config) 38
:else 20)
:style {:width "1lh"
:height "1lh"
:font-size (cond
(and (util/mobile?) (:page-title? config)) 24
(:page-title? config) 38
:else 18)}}})])))]
:class "!p-0"})
:icon-props {:size (if (:page-title? config) 38 20)}})])))]
[:div.ls-block.swipe-item
(cond->
{:id (str "ls-block-"

View File

@@ -1141,18 +1141,33 @@ html.is-mac {
color: var(--rx-gray-09);
}
.ls-page-title .ls-page-icon svg, .ls-page-title .ls-page-icon button {
/* Page-title icon container: vertically center the trigger button so the
icon optically aligns with the title text. The previous `.self-start`
on this element top-aligned the icon, which left every type relying on
its own intrinsic baseline (emoji on font baseline, SVG on bottom
anchor, etc.) — visible as cross-type misalignment when the hover
preview swapped types mid-row. */
.ls-page-title .ls-page-icon {
display: flex;
align-items: center;
}
/* Trigger button: fixed-size flex-center box. All icon types (emoji,
tabler, text, avatar, image, image-placeholder) render at :size 38
inside this box, so flex-centering puts every type's visual centroid
at the box midpoint — uniform vertical anchor regardless of the
element's intrinsic baseline. */
.ls-page-title .ls-page-icon button {
display: inline-flex;
align-items: center;
justify-content: center;
width: 38px;
height: 38px;
}
/* Image icons in page title - fill the button like avatars do */
.ls-page-title .ls-page-icon .image-icon {
width: 2rem !important; /* 32px, matching avatar size */
height: 2rem !important;
display: flex;
align-items: center;
justify-content: center;
/* Per-type fixups: avatar fallback font size and image asset fill. */
.ls-page-title .ls-page-icon .ui__avatar span {
font-size: 16px;
}
.ls-page-title .ls-page-icon .image-icon img {
@@ -1161,16 +1176,6 @@ html.is-mac {
object-fit: contain;
}
/* Scale up avatars in page title context */
.ls-page-title .ls-page-icon .ui__avatar {
width: 38px;
height: 38px;
}
.ls-page-title .ls-page-icon .ui__avatar span {
font-size: 16px;
}
.ls-page-title .positioned-properties.block-left svg,
.ls-page-title .positioned-properties.block-right svg {
width: 24px;
@@ -1212,10 +1217,6 @@ html.is-mac {
}
}
.ls-page-title .ls-page-icon button {
margin-top: 8px;
}
.ls-page-title .block-tags {
@apply relative min-h-full;
}

View File

@@ -68,6 +68,13 @@
.block-main-container {
@apply gap-2;
}
/* Icon-to-title spacing in the page-title row. The base
`.block-main-content` is `gap-2` (8px) for regular blocks; the
page title's icon is bigger (38px box) and benefits from more
breathing room — bump to `gap-3` (12px) just here. */
.block-main-content {
@apply gap-3;
}
}
.edit-input {