data: ignore header and footer when content is set
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
//! The sidebar: a controlled list with section headers — the Finder
|
||||
//! sidebar's model of rows grouped under non-selectable labels. Custom content
|
||||
//! can replace the list, leaving a bare container with the header and footer
|
||||
//! slots around it.
|
||||
//! replaces the list and takes the whole container; the header and footer
|
||||
//! slots apply only to the entry list.
|
||||
|
||||
use std::rc::Rc;
|
||||
|
||||
@@ -180,7 +180,7 @@ impl Sidebar {
|
||||
self
|
||||
}
|
||||
|
||||
/// Pins an element above the body, below nothing else.
|
||||
/// Pins an element above the list, ignored when content is set.
|
||||
pub fn header<E>(mut self, header: E) -> Self
|
||||
where
|
||||
E: IntoElement,
|
||||
@@ -189,7 +189,7 @@ impl Sidebar {
|
||||
self
|
||||
}
|
||||
|
||||
/// Replaces the entries with custom content.
|
||||
/// Replaces the list with custom content spanning the whole container.
|
||||
pub fn content<E>(mut self, content: E) -> Self
|
||||
where
|
||||
E: IntoElement,
|
||||
@@ -198,7 +198,7 @@ impl Sidebar {
|
||||
self
|
||||
}
|
||||
|
||||
/// Pins an element below the body, above nothing else.
|
||||
/// Pins an element below the list, ignored when content is set.
|
||||
pub fn footer<E>(mut self, footer: E) -> Self
|
||||
where
|
||||
E: IntoElement,
|
||||
@@ -232,6 +232,12 @@ impl RenderOnce for Sidebar {
|
||||
} = self;
|
||||
|
||||
let custom = content.is_some();
|
||||
let (header, footer) = if custom {
|
||||
(None, None)
|
||||
} else {
|
||||
(header, footer)
|
||||
};
|
||||
|
||||
let label = a11y_label.unwrap_or_else(|| SharedString::from(id.to_string()));
|
||||
let debug_id = id.clone();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user