zino_dioxus/typography/
span.rsuse crate::class::Class;
use dioxus::prelude::*;
use zino_core::{JsonValue, SharedString};
pub fn FixedWidthSpan(props: FixedWidthSpanProps) -> Element {
let mut style = match props.width {
JsonValue::Number(value) => format!("width:{value}px;"),
JsonValue::String(value) => format!("width:{value};"),
_ => String::new(),
};
style.push_str("text-align:");
style.push_str(props.align.as_ref());
rsx! {
span {
class: props.class,
style: style,
{ props.children }
}
}
}
#[derive(Clone, PartialEq, Props)]
pub struct FixedWidthSpanProps {
#[props(into, default = "is-inline-block")]
pub class: Class,
#[props(into)]
pub width: JsonValue,
#[props(into, default = "left")]
pub align: SharedString,
children: Element,
}