BlueGit

ict rusty-teams

fix(post): space the subheading from the announcement banner

- 8 px gap between banner and subheading
- layout_guard checks the gap

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

metis Daniel Däschle · pushed by metis

Authored 2026-11-10 · 3 weeks ago

Hash
29720f519fbfa75c985ed5241a033038575492b0
Parent
ec36c5a5
2 files changed +7 −1
crates/app/src/layout_guard.rs +2 −0
@@ -2188,6 +2188,8 @@ mod frames {
2188 2188 let banner = bounds_of(POST_ANNOUNCEMENT_TAG);
2189 2189 let subject = bounds_of(POST_CARD_SUBJECT_TAG);
2190 2190 assert!(header.bottom() <= banner.top() && banner.bottom() <= subject.top());
2191 let gap = f32::from(subject.top() - banner.bottom());
2192 assert!(gap >= 6., "subheading {gap} px under the banner");
2191 2193 let audience = bounds_of(POST_AUDIENCE_TAG);
2192 2194 assert!(audience.bottom() <= card.top(), "audience hint not above the card");
2193 2195 let left = f32::from(banner.left() - card.left());
@@ -2188,6 +2188,8 @@ mod frames {
2188 let banner = bounds_of(POST_ANNOUNCEMENT_TAG);
2188 let banner = bounds_of(POST_ANNOUNCEMENT_TAG);
2189 let subject = bounds_of(POST_CARD_SUBJECT_TAG);
2189 let subject = bounds_of(POST_CARD_SUBJECT_TAG);
2190 assert!(header.bottom() <= banner.top() && banner.bottom() <= subject.top());
2190 assert!(header.bottom() <= banner.top() && banner.bottom() <= subject.top());
2191 let gap = f32::from(subject.top() - banner.bottom());
2192 assert!(gap >= 6., "subheading {gap} px under the banner");
2191 let audience = bounds_of(POST_AUDIENCE_TAG);
2193 let audience = bounds_of(POST_AUDIENCE_TAG);
2192 assert!(audience.bottom() <= card.top(), "audience hint not above the card");
2194 assert!(audience.bottom() <= card.top(), "audience hint not above the card");
2193 let left = f32::from(banner.left() - card.left());
2195 let left = f32::from(banner.left() - card.left());
crates/app/src/views/composer/post.rs +5 −1
@@ -46,6 +46,7 @@ const SUBJECT_SIZE: f32 = 18.;
46 46 const INPUT_TEXT_SCALE: f32 = 0.875;
47 47 const SUBJECT_INSET: f32 = 8.;
48 48 const TEXT_INSET: f32 = 16.;
49 const SUBHEADING_GAP: f32 = 8.;
49 50
50 51 pub(super) struct AnnouncementDraft {
51 52 pub(super) headline: Entity<InputState>,
@@ -460,6 +461,8 @@ impl Composer {
460 461 .tooltip(|window, cx| Tooltip::new(CLOSE_TOOLTIP).build(window, cx))
461 462 .child(symbol("close", 18., theme::text_muted()))
462 463 .on_click(cx.listener(|_, _, _, cx| cx.emit(ComposerEvent::ClosePost)));
464 let announcement = self.render_announcement(cx);
465 let has_banner = announcement.is_some();
463 466 Some(
464 467 v_flex()
465 468 .w_full()
@@ -475,11 +478,12 @@ impl Composer {
475 478 .child(div().flex_1())
476 479 .child(close),
477 480 )
478 .children(self.render_announcement(cx))
481 .children(announcement)
479 482 .child(
480 483 div()
481 484 .debug_selector(|| POST_CARD_SUBJECT_TAG.into())
482 485 .w_full()
486 .when(has_banner, |subject| subject.mt(px(SUBHEADING_GAP)))
483 487 .px(px(SUBJECT_INSET))
484 488 .py(px(6.))
485 489 .font_weight(FontWeight::SEMIBOLD)
@@ -46,6 +46,7 @@ const SUBJECT_SIZE: f32 = 18.;
46const INPUT_TEXT_SCALE: f32 = 0.875;
46const INPUT_TEXT_SCALE: f32 = 0.875;
47const SUBJECT_INSET: f32 = 8.;
47const SUBJECT_INSET: f32 = 8.;
48const TEXT_INSET: f32 = 16.;
48const TEXT_INSET: f32 = 16.;
49const SUBHEADING_GAP: f32 = 8.;
49
50
50pub(super) struct AnnouncementDraft {
51pub(super) struct AnnouncementDraft {
51 pub(super) headline: Entity<InputState>,
52 pub(super) headline: Entity<InputState>,
@@ -460,6 +461,8 @@ impl Composer {
460 .tooltip(|window, cx| Tooltip::new(CLOSE_TOOLTIP).build(window, cx))
461 .tooltip(|window, cx| Tooltip::new(CLOSE_TOOLTIP).build(window, cx))
461 .child(symbol("close", 18., theme::text_muted()))
462 .child(symbol("close", 18., theme::text_muted()))
462 .on_click(cx.listener(|_, _, _, cx| cx.emit(ComposerEvent::ClosePost)));
463 .on_click(cx.listener(|_, _, _, cx| cx.emit(ComposerEvent::ClosePost)));
464 let announcement = self.render_announcement(cx);
465 let has_banner = announcement.is_some();
463 Some(
466 Some(
464 v_flex()
467 v_flex()
465 .w_full()
468 .w_full()
@@ -475,11 +478,12 @@ impl Composer {
475 .child(div().flex_1())
478 .child(div().flex_1())
476 .child(close),
479 .child(close),
477 )
480 )
478 .children(self.render_announcement(cx))
481 .children(announcement)
479 .child(
482 .child(
480 div()
483 div()
481 .debug_selector(|| POST_CARD_SUBJECT_TAG.into())
484 .debug_selector(|| POST_CARD_SUBJECT_TAG.into())
482 .w_full()
485 .w_full()
486 .when(has_banner, |subject| subject.mt(px(SUBHEADING_GAP)))
483 .px(px(SUBJECT_INSET))
487 .px(px(SUBJECT_INSET))
484 .py(px(6.))
488 .py(px(6.))
485 .font_weight(FontWeight::SEMIBOLD)
489 .font_weight(FontWeight::SEMIBOLD)