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
|
//! The sidebar: a controlled list with section headers — the Finder
|
||||||
//! sidebar's model of rows grouped under non-selectable labels. Custom content
|
//! 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
|
//! replaces the list and takes the whole container; the header and footer
|
||||||
//! slots around it.
|
//! slots apply only to the entry list.
|
||||||
|
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
|
|
||||||
@@ -180,7 +180,7 @@ impl Sidebar {
|
|||||||
self
|
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
|
pub fn header<E>(mut self, header: E) -> Self
|
||||||
where
|
where
|
||||||
E: IntoElement,
|
E: IntoElement,
|
||||||
@@ -189,7 +189,7 @@ impl Sidebar {
|
|||||||
self
|
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
|
pub fn content<E>(mut self, content: E) -> Self
|
||||||
where
|
where
|
||||||
E: IntoElement,
|
E: IntoElement,
|
||||||
@@ -198,7 +198,7 @@ impl Sidebar {
|
|||||||
self
|
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
|
pub fn footer<E>(mut self, footer: E) -> Self
|
||||||
where
|
where
|
||||||
E: IntoElement,
|
E: IntoElement,
|
||||||
@@ -232,6 +232,12 @@ impl RenderOnce for Sidebar {
|
|||||||
} = self;
|
} = self;
|
||||||
|
|
||||||
let custom = content.is_some();
|
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 label = a11y_label.unwrap_or_else(|| SharedString::from(id.to_string()));
|
||||||
let debug_id = id.clone();
|
let debug_id = id.clone();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user