refactor root component

This commit is contained in:
2026-01-16 15:29:34 +07:00
parent 4c4fe0cc0c
commit 81b1f2b293
21 changed files with 445 additions and 412 deletions

View File

@@ -13,7 +13,7 @@ use theme::ActiveTheme;
use crate::actions::{Cancel, Confirm};
use crate::animation::cubic_bezier;
use crate::button::{Button, ButtonCustomVariant, ButtonVariant, ButtonVariants as _};
use crate::{h_flex, v_flex, ContextModal, IconName, Root, Sizable, StyledExt};
use crate::{h_flex, v_flex, IconName, Root, Sizable, StyledExt, WindowExtension};
const CONTEXT: &str = "Modal";
@@ -97,9 +97,9 @@ pub struct Modal {
button_props: ModalButtonProps,
/// This will be change when open the modal, the focus handle is create when open the modal.
pub(crate) focus_handle: FocusHandle,
pub(crate) layer_ix: usize,
pub(crate) overlay_visible: bool,
pub focus_handle: FocusHandle,
pub layer_ix: usize,
pub overlay_visible: bool,
}
impl Modal {
@@ -255,7 +255,7 @@ impl Modal {
self
}
pub(crate) fn has_overlay(&self) -> bool {
pub fn has_overlay(&self) -> bool {
self.overlay
}
}
@@ -341,7 +341,7 @@ impl RenderOnce for Modal {
}
});
let window_paddings = crate::window_border::window_paddings(window, cx);
let window_paddings = crate::root::window_paddings(window, cx);
let radius = (cx.theme().radius_lg * 2.).min(px(20.));
let view_size = window.viewport_size()