group_box: Fix incorrect h_full in GroupBox. (#1253)

Also fix the notifications example.
This commit is contained in:
Jason Lee 2025-09-16 21:23:29 +08:00 committed by GitHub
parent 5ddaa9f5aa
commit 3c39641486
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 6 additions and 5 deletions

View file

@ -1,13 +1,13 @@
use gpui::{ use gpui::{
div, App, AppContext, Context, Entity, FocusHandle, Focusable, InteractiveElement as _, App, AppContext, Context, Entity, FocusHandle, Focusable, InteractiveElement as _, IntoElement,
IntoElement, ParentElement, Render, Styled, Window, ParentElement, Render, Styled, Window,
}; };
use gpui_component::{ use gpui_component::{
button::{Button, ButtonVariants}, button::{Button, ButtonVariants},
notification::{Notification, NotificationType}, notification::{Notification, NotificationType},
text::TextView, text::TextView,
ContextModal as _, v_flex, ContextModal as _,
}; };
use crate::section; use crate::section;
@ -57,10 +57,11 @@ impl Focusable for NotificationStory {
impl Render for NotificationStory { impl Render for NotificationStory {
fn render(&mut self, _: &mut Window, cx: &mut Context<Self>) -> impl IntoElement { fn render(&mut self, _: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
div() v_flex()
.id("notification-story") .id("notification-story")
.track_focus(&self.focus_handle) .track_focus(&self.focus_handle)
.size_full() .size_full()
.gap_3()
.child( .child(
section("Simple Notification").child( section("Simple Notification").child(
Button::new("show-notify-0") Button::new("show-notify-0")

View file

@ -107,7 +107,7 @@ impl RenderOnce for GroupBox {
v_flex() v_flex()
.id(self.id.unwrap_or("group-box".into())) .id(self.id.unwrap_or("group-box".into()))
.size_full() .w_full()
.when(has_paddings, |this| this.gap_3()) .when(has_paddings, |this| this.gap_3())
.when(!has_paddings, |this| this.gap_4()) .when(!has_paddings, |this| this.gap_4())
.refine_style(&self.style) .refine_style(&self.style)