use crate::utils::types::SharedAppState;
use crate::{rumtk_web_get_config, ComponentResult, RUMWebTemplate, DEFAULT_ICON_SOURCE, DEFAULT_ICON_TYPE};
use rumtk_core::strings::RUMString;
#[derive(RUMWebTemplate, Debug, Clone)]
#[template(
source = "
<link rel='icon' type='{{typ}}' href='{{src}}'>
",
ext = "html"
)]
pub struct FavIcon {
src: RUMString,
typ: RUMString,
}
pub fn favicon<'a>(state: SharedAppState) -> ComponentResult<FavIcon> {
let src = rumtk_web_get_config!(state).header_conf.icon_source.clone().unwrap_or(DEFAULT_ICON_SOURCE.to_string());
let typ = rumtk_web_get_config!(state).header_conf.icon_type.clone().unwrap_or(DEFAULT_ICON_TYPE.to_string());
Ok(FavIcon {
src,
typ,
})
}