drawer: Set paddings to base to support override drawer body paddings. (#413)
Co-authored-by: Jason Lee <huacnlee@gmail.com>
This commit is contained in:
parent
40345f1e42
commit
d53b30ff9f
2 changed files with 8 additions and 11 deletions
|
|
@ -19,10 +19,7 @@ use ui::{
|
||||||
theme::ActiveTheme as _,
|
theme::ActiveTheme as _,
|
||||||
v_flex,
|
v_flex,
|
||||||
webview::WebView,
|
webview::WebView,
|
||||||
ContextModal as _,
|
ContextModal as _, Icon, IconName, Placement,
|
||||||
Icon,
|
|
||||||
IconName,
|
|
||||||
Placement
|
|
||||||
};
|
};
|
||||||
|
|
||||||
actions!(modal_story, [TestAction]);
|
actions!(modal_story, [TestAction]);
|
||||||
|
|
@ -499,18 +496,18 @@ impl Render for ModalStory {
|
||||||
WebView::new(cx, webview)
|
WebView::new(cx, webview)
|
||||||
});
|
});
|
||||||
webview.update(cx, |webview, _| {
|
webview.update(cx, |webview, _| {
|
||||||
webview.load_url("https://github.com");
|
webview.load_url("https://github.com/explore");
|
||||||
});
|
});
|
||||||
cx.open_drawer(move |drawer, cx| {
|
cx.open_drawer(move |drawer, cx| {
|
||||||
let height = cx.window_bounds().get_bounds().size.height;
|
let height = cx.window_bounds().get_bounds().size.height;
|
||||||
let webview_bounds = webview.read(cx).bounds();
|
let webview_bounds = webview.read(cx).bounds();
|
||||||
let buffer_height = px(12.);
|
|
||||||
|
|
||||||
drawer
|
drawer
|
||||||
.title("WebView Title")
|
.title("WebView Title")
|
||||||
|
.p_0()
|
||||||
.child(
|
.child(
|
||||||
div()
|
div()
|
||||||
.h(height - webview_bounds.origin.y - buffer_height)
|
.h(height - webview_bounds.origin.y)
|
||||||
.child(webview.clone())
|
.child(webview.clone())
|
||||||
)
|
)
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,7 @@ impl Drawer {
|
||||||
resizable: true,
|
resizable: true,
|
||||||
title: None,
|
title: None,
|
||||||
footer: None,
|
footer: None,
|
||||||
content: v_flex(),
|
content: v_flex().px_4().py_3(),
|
||||||
margin_top: TITLE_BAR_HEIGHT,
|
margin_top: TITLE_BAR_HEIGHT,
|
||||||
overlay: true,
|
overlay: true,
|
||||||
on_close: Rc::new(|_, _| {}),
|
on_close: Rc::new(|_, _| {}),
|
||||||
|
|
@ -189,7 +189,7 @@ impl RenderOnce for Drawer {
|
||||||
h_flex()
|
h_flex()
|
||||||
.justify_between()
|
.justify_between()
|
||||||
.px_4()
|
.px_4()
|
||||||
.py_3()
|
.py_2()
|
||||||
.w_full()
|
.w_full()
|
||||||
.child(self.title.unwrap_or(div().into_any_element()))
|
.child(self.title.unwrap_or(div().into_any_element()))
|
||||||
.child(
|
.child(
|
||||||
|
|
@ -204,10 +204,9 @@ impl RenderOnce for Drawer {
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
.child(
|
.child(
|
||||||
|
// Body
|
||||||
div().flex_1().overflow_hidden().child(
|
div().flex_1().overflow_hidden().child(
|
||||||
v_flex()
|
v_flex()
|
||||||
.p_4()
|
|
||||||
.pt_0()
|
|
||||||
.scrollable(
|
.scrollable(
|
||||||
cx.parent_view_id().unwrap_or_default(),
|
cx.parent_view_id().unwrap_or_default(),
|
||||||
ScrollbarAxis::Vertical,
|
ScrollbarAxis::Vertical,
|
||||||
|
|
@ -216,6 +215,7 @@ impl RenderOnce for Drawer {
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
.when_some(self.footer, |this, footer| {
|
.when_some(self.footer, |this, footer| {
|
||||||
|
// Footer
|
||||||
this.child(
|
this.child(
|
||||||
h_flex()
|
h_flex()
|
||||||
.justify_between()
|
.justify_between()
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue