use teksilo_core::build_context::BuildContext;
use teksilo_core::styles::{
ListContainerStyle, ListInsertionConfig, ListInsertionRecipe, SharedListContainerStyle,
};
use teksilo_core::widget_id::WidgetId;
use teksilo_tokens::BorderRole;
use crate::primitives::RectWidget;
#[derive(Debug, Default, Clone, Copy)]
pub struct RecipeListContainerStyle;
impl ListContainerStyle for RecipeListContainerStyle {
fn make_insertion_indicator(
&self,
cfg: &ListInsertionConfig,
ctx: &mut BuildContext,
) -> WidgetId {
let _ = cfg.axis_offset; let _ = cfg.width;
ctx.add(RectWidget::new().background(BorderRole::Accent))
}
fn insertion(&self) -> ListInsertionRecipe {
ListInsertionRecipe::default()
}
}
pub fn resolve_list_container_style(
override_: &Option<SharedListContainerStyle>,
ctx: &BuildContext,
) -> SharedListContainerStyle {
if let Some(s) = override_.clone() {
return s;
}
ctx.theme_signal()
.get()
.style_slots
.list_container
.clone()
.unwrap_or_else(|| std::rc::Rc::new(RecipeListContainerStyle) as SharedListContainerStyle)
}