← back to joeleaver__rinch

Function bodies 1,000 total

All specs Real LLM only Function bodies
get_initials function · rust · L171-L185 (15 LOC)
crates/rinch-components/src/avatar.rs
    fn get_initials(&self) -> Option<String> {
        if self.name.is_empty() {
            None
        } else {
            Some(
                self.name
                    .split_whitespace()
                    .filter_map(|word| word.chars().next())
                    .take(2)
                    .collect::<String>()
                    .to_uppercase(),
            )
        }
    }
render function · rust · L189-L222 (34 LOC)
crates/rinch-components/src/avatar.rs
    fn render(&self, __scope: &mut RenderScope, _children: &[NodeHandle]) -> NodeHandle {
        let container = rinch_macros::rsx! { div { class: "rinch-avatar" } };
        container.set_attribute("class", &self.class_string());

        if !self.color.is_empty() {
            let c = &self.color;
            let style = if c.starts_with('#') || c.starts_with("rgb") || c.starts_with("hsl") {
                format!("--rinch-avatar-color: {}", c)
            } else {
                format!("--rinch-avatar-color: var(--rinch-color-{}-6)", c)
            };
            container.set_attribute("style", &style);
        }

        if !self.src.is_empty() {
            let src = &self.src;
            let alt = if self.alt.is_empty() { "" } else { &self.alt };
            let img = rinch_macros::rsx! { img { class: "rinch-avatar__image" } };
            img.set_attribute("src", src);
            img.set_attribute("alt", alt);
            container.append_child(&img);
        } else if le
render function · rust · L233-L248 (16 LOC)
crates/rinch-components/src/avatar.rs
    fn render(&self, __scope: &mut RenderScope, children: &[NodeHandle]) -> NodeHandle {
        let container = rinch_macros::rsx! { div { class: "rinch-avatar-group" } };

        if !self.spacing.is_empty() {
            let spacing = &self.spacing;
            container.set_attribute(
                "style",
                &format!("--rinch-avatar-group-spacing: {}", spacing),
            );
        }

        for child in children {
            container.append_child(child);
        }
        container
    }
class_name function · rust · L24-L31 (8 LOC)
crates/rinch-components/src/badge.rs
    pub fn class_name(&self) -> &'static str {
        match self {
            BadgeVariant::Filled => "rinch-badge--filled",
            BadgeVariant::Light => "rinch-badge--light",
            BadgeVariant::Outline => "rinch-badge--outline",
            BadgeVariant::Dot => "rinch-badge--dot",
        }
    }
from_str function · rust · L36-L45 (10 LOC)
crates/rinch-components/src/badge.rs
    fn from_str(s: &str) -> Result<Self, Self::Err> {
        match s.to_lowercase().as_str() {
            "filled" => Ok(BadgeVariant::Filled),
            "light" => Ok(BadgeVariant::Light),
            "outline" => Ok(BadgeVariant::Outline),
            "dot" => Ok(BadgeVariant::Dot),
            _ => Err(()),
        }
    }
class_name function · rust · L61-L69 (9 LOC)
crates/rinch-components/src/badge.rs
    pub fn class_name(&self) -> &'static str {
        match self {
            BadgeSize::Xs => "rinch-badge--xs",
            BadgeSize::Sm => "rinch-badge--sm",
            BadgeSize::Md => "rinch-badge--md",
            BadgeSize::Lg => "rinch-badge--lg",
            BadgeSize::Xl => "rinch-badge--xl",
        }
    }
from_str function · rust · L74-L84 (11 LOC)
crates/rinch-components/src/badge.rs
    fn from_str(s: &str) -> Result<Self, Self::Err> {
        match s.to_lowercase().as_str() {
            "xs" => Ok(BadgeSize::Xs),
            "sm" => Ok(BadgeSize::Sm),
            "md" => Ok(BadgeSize::Md),
            "lg" => Ok(BadgeSize::Lg),
            "xl" => Ok(BadgeSize::Xl),
            _ => Err(()),
        }
    }
Open data scored by Repobility · https://repobility.com
class_string function · rust · L104-L129 (26 LOC)
crates/rinch-components/src/badge.rs
    pub fn class_string(&self) -> String {
        let mut classes = vec!["rinch-badge"];

        // Size class
        let size: BadgeSize = if self.size.is_empty() {
            BadgeSize::default()
        } else {
            self.size.parse().unwrap_or_default()
        };
        classes.push(size.class_name());

        // Variant class
        let variant: BadgeVariant = if self.variant.is_empty() {
            BadgeVariant::default()
        } else {
            self.variant.parse().unwrap_or_default()
        };
        classes.push(variant.class_name());

        // Full width
        if self.full_width {
            classes.push("rinch-badge--full-width");
        }

        classes.join(" ")
    }
render function · rust · L133-L145 (13 LOC)
crates/rinch-components/src/badge.rs
    fn render(&self, __scope: &mut RenderScope, children: &[NodeHandle]) -> NodeHandle {
        let container = rinch_macros::rsx! { span { class: "rinch-badge" } };
        container.set_attribute("class", &self.class_string());

        if !self.color.is_empty() {
            container.set_attribute("data-color", &self.color);
        }

        for child in children {
            container.append_child(child);
        }
        container
    }
class_string function · rust · L33-L52 (20 LOC)
crates/rinch-components/src/blockquote.rs
    pub fn class_string(&self) -> String {
        let mut classes = vec!["rinch-blockquote"];

        if self.icon.is_some() {
            classes.push("rinch-blockquote--with-icon");
        }

        if !self.radius.is_empty() {
            classes.push(match self.radius.as_str() {
                "xs" => "rinch-blockquote--radius-xs",
                "sm" => "rinch-blockquote--radius-sm",
                "md" => "rinch-blockquote--radius-md",
                "lg" => "rinch-blockquote--radius-lg",
                "xl" => "rinch-blockquote--radius-xl",
                _ => "",
            });
        }

        classes.join(" ")
    }
render function · rust · L56-L95 (40 LOC)
crates/rinch-components/src/blockquote.rs
    fn render(&self, __scope: &mut RenderScope, children: &[NodeHandle]) -> NodeHandle {
        let container = rinch_macros::rsx! { blockquote { class: "rinch-blockquote" } };
        container.set_attribute("class", &self.class_string());

        // Color style
        if !self.color.is_empty() {
            let c = &self.color;
            let style = if c.starts_with('#') || c.starts_with("rgb") || c.starts_with("hsl") {
                format!("--rinch-blockquote-color: {}", c)
            } else {
                format!("--rinch-blockquote-color: var(--rinch-color-{}-6)", c)
            };
            container.set_attribute("style", &style);
        }

        // Icon element
        if let Some(icon) = self.icon {
            let icon_wrapper = rinch_macros::rsx! { span { class: "rinch-blockquote__icon" } };
            let icon_el = render_tabler_icon(__scope, icon, TablerIconStyle::Outline);
            icon_wrapper.append_child(&icon_el);
            container.append_chil
class_name function · rust · L54-L63 (10 LOC)
crates/rinch-components/src/borderless_window.rs
    pub fn class_name(&self) -> &'static str {
        match self {
            WindowRadius::None => "rinch-borderlesswindow--radius-none",
            WindowRadius::Xs => "rinch-borderlesswindow--radius-xs",
            WindowRadius::Sm => "rinch-borderlesswindow--radius-sm",
            WindowRadius::Md => "rinch-borderlesswindow--radius-md",
            WindowRadius::Lg => "rinch-borderlesswindow--radius-lg",
            WindowRadius::Xl => "rinch-borderlesswindow--radius-xl",
        }
    }
from_str function · rust · L68-L79 (12 LOC)
crates/rinch-components/src/borderless_window.rs
    fn from_str(s: &str) -> Result<Self, Self::Err> {
        match s.to_lowercase().as_str() {
            "none" | "0" => Ok(WindowRadius::None),
            "xs" => Ok(WindowRadius::Xs),
            "sm" => Ok(WindowRadius::Sm),
            "md" => Ok(WindowRadius::Md),
            "lg" => Ok(WindowRadius::Lg),
            "xl" => Ok(WindowRadius::Xl),
            _ => Err(()),
        }
    }
fmt function · rust · L118-L131 (14 LOC)
crates/rinch-components/src/borderless_window.rs
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.debug_struct("BorderlessWindow")
            .field("title", &self.title)
            .field("radius", &self.radius)
            .field("show_minimize", &self.show_minimize)
            .field("show_maximize", &self.show_maximize)
            .field("show_close", &self.show_close)
            .field("left_section", &self.left_section.as_ref().map(|_| "..."))
            .field("right_section", &self.right_section.as_ref().map(|_| "..."))
            .field("on_minimize", &self.on_minimize.as_ref().map(|_| "..."))
            .field("on_maximize", &self.on_maximize.as_ref().map(|_| "..."))
            .field("on_close", &self.on_close.as_ref().map(|_| "..."))
            .finish()
    }
default function · rust · L135-L148 (14 LOC)
crates/rinch-components/src/borderless_window.rs
    fn default() -> Self {
        Self {
            title: String::new(),
            radius: String::new(),
            show_minimize: true,
            show_maximize: true,
            show_close: true,
            left_section: None,
            right_section: None,
            on_minimize: None,
            on_maximize: None,
            on_close: None,
        }
    }
Generated by Repobility's multi-pass static-analysis pipeline (https://repobility.com)
class_string function · rust · L153-L166 (14 LOC)
crates/rinch-components/src/borderless_window.rs
    pub fn class_string(&self) -> String {
        let mut classes = vec!["rinch-borderlesswindow"];

        // Radius
        if !self.radius.is_empty() {
            if let Ok(r) = self.radius.parse::<WindowRadius>() {
                classes.push(r.class_name());
            }
        } else {
            classes.push(WindowRadius::default().class_name());
        }

        classes.join(" ")
    }
render function · rust · L30-L56 (27 LOC)
crates/rinch-components/src/breadcrumbs.rs
    fn render(&self, __scope: &mut RenderScope, children: &[NodeHandle]) -> NodeHandle {
        let separator = if self.separator.is_empty() {
            "/"
        } else {
            &self.separator
        };

        let nav = rinch_macros::rsx! { nav { class: "rinch-breadcrumbs" } };
        nav.set_attribute("aria-label", "Breadcrumb");

        if !self.separator_margin.is_empty() {
            nav.set_attribute(
                "style",
                &format!("--rinch-breadcrumbs-margin: {}", self.separator_margin),
            );
        }

        let ol = rinch_macros::rsx! { ol { class: "rinch-breadcrumbs__list" } };
        ol.set_attribute("data-separator", &html_escape(separator));

        for child in children {
            ol.append_child(child);
        }

        nav.append_child(&ol);
        nav
    }
render function · rust · L67-L87 (21 LOC)
crates/rinch-components/src/breadcrumbs.rs
    fn render(&self, __scope: &mut RenderScope, children: &[NodeHandle]) -> NodeHandle {
        let li = rinch_macros::rsx! { li { class: "rinch-breadcrumbs__item" } };

        let content = if !self.href.is_empty() {
            let link = rinch_macros::rsx! { a { class: "rinch-breadcrumbs__link" } };
            link.set_attribute("href", &self.href);
            for child in children {
                link.append_child(child);
            }
            link
        } else {
            let span = rinch_macros::rsx! { span { class: "rinch-breadcrumbs__item--active" } };
            for child in children {
                span.append_child(child);
            }
            span
        };

        li.append_child(&content);
        li
    }
html_escape function · rust · L89-L96 (8 LOC)
crates/rinch-components/src/breadcrumbs.rs
fn html_escape(s: &str) -> String {
    s.replace('&', "&amp;")
        .replace('<', "&lt;")
        .replace('>', "&gt;")
        .replace('"', "&quot;")
        .replace('\'', "&#39;")
}
class_name function · rust · L26-L34 (9 LOC)
crates/rinch-components/src/button.rs
    pub fn class_name(&self) -> &'static str {
        match self {
            ButtonVariant::Filled => "rinch-button--filled",
            ButtonVariant::Outline => "rinch-button--outline",
            ButtonVariant::Light => "rinch-button--light",
            ButtonVariant::Subtle => "rinch-button--subtle",
            ButtonVariant::Default => "rinch-button--default",
        }
    }
from_str function · rust · L39-L49 (11 LOC)
crates/rinch-components/src/button.rs
    fn from_str(s: &str) -> Result<Self, Self::Err> {
        match s.to_lowercase().as_str() {
            "filled" => Ok(ButtonVariant::Filled),
            "outline" => Ok(ButtonVariant::Outline),
            "light" => Ok(ButtonVariant::Light),
            "subtle" => Ok(ButtonVariant::Subtle),
            "default" => Ok(ButtonVariant::Default),
            _ => Err(()),
        }
    }
class_name function · rust · L65-L73 (9 LOC)
crates/rinch-components/src/button.rs
    pub fn class_name(&self) -> &'static str {
        match self {
            ButtonSize::Xs => "rinch-button--xs",
            ButtonSize::Sm => "rinch-button--sm",
            ButtonSize::Md => "rinch-button--md",
            ButtonSize::Lg => "rinch-button--lg",
            ButtonSize::Xl => "rinch-button--xl",
        }
    }
from_str function · rust · L78-L88 (11 LOC)
crates/rinch-components/src/button.rs
    fn from_str(s: &str) -> Result<Self, Self::Err> {
        match s.to_lowercase().as_str() {
            "xs" => Ok(ButtonSize::Xs),
            "sm" => Ok(ButtonSize::Sm),
            "md" => Ok(ButtonSize::Md),
            "lg" => Ok(ButtonSize::Lg),
            "xl" => Ok(ButtonSize::Xl),
            _ => Err(()),
        }
    }
Want this analysis on your repo? https://repobility.com/scan/
class_string function · rust · L114-L166 (53 LOC)
crates/rinch-components/src/button.rs
    pub fn class_string(&self) -> String {
        let mut classes = vec!["rinch-button"];

        // Size class
        let size: ButtonSize = if self.size.is_empty() {
            ButtonSize::default()
        } else {
            self.size.parse().unwrap_or_default()
        };
        classes.push(size.class_name());

        // Variant class
        let variant: ButtonVariant = if self.variant.is_empty() {
            ButtonVariant::default()
        } else {
            self.variant.parse().unwrap_or_default()
        };
        classes.push(variant.class_name());

        // Full width
        if self.full_width {
            classes.push("rinch-button--full-width");
        }

        // Disabled
        if self.disabled {
            classes.push("rinch-button--disabled");
        }

        // Loading
        if self.loading {
            classes.push("rinch-button--loading");
        }

        // Custom color
        if !self.color.is_empty() {
            classes.push("ri
style_string function · rust · L169-L181 (13 LOC)
crates/rinch-components/src/button.rs
    pub fn style_string(&self) -> Option<String> {
        if self.color.is_empty() {
            None
        } else {
            Some(format!(
                "--rinch-button-color: var(--rinch-color-{}-6); \
                 --rinch-button-color-hover: var(--rinch-color-{}-7); \
                 --rinch-button-color-light: var(--rinch-color-{}-0); \
                 --rinch-button-color-light-hover: var(--rinch-color-{}-1);",
                self.color, self.color, self.color, self.color
            ))
        }
    }
render function · rust · L185-L210 (26 LOC)
crates/rinch-components/src/button.rs
    fn render(&self, __scope: &mut RenderScope, children: &[NodeHandle]) -> NodeHandle {
        let container = rinch_macros::rsx! { button { class: "rinch-button" } };
        container.set_attribute("class", &self.class_string());

        if let Some(style) = self.style_string() {
            container.set_attribute("style", &style);
        }

        if self.disabled {
            container.set_attribute("disabled", "");
        }

        // Click handler
        if let Some(cb) = &self.onclick {
            let handler_id = __scope.register_handler({
                let cb = cb.clone();
                move || cb.invoke()
            });
            container.set_attribute("data-rid", &handler_id.0.to_string());
        }

        for child in children {
            container.append_child(child);
        }
        container
    }
class_name function · rust · L20-L28 (9 LOC)
crates/rinch-components/src/card.rs
    pub fn class_name(&self) -> &'static str {
        match self {
            CardPadding::Xs => "rinch-card--p-xs",
            CardPadding::Sm => "rinch-card--p-sm",
            CardPadding::Md => "rinch-card--p-md",
            CardPadding::Lg => "rinch-card--p-lg",
            CardPadding::Xl => "rinch-card--p-xl",
        }
    }
from_str function · rust · L33-L42 (10 LOC)
crates/rinch-components/src/card.rs
    fn from_str(s: &str) -> Result<Self, Self::Err> {
        match s.to_lowercase().as_str() {
            "xs" => Ok(CardPadding::Xs),
            "sm" => Ok(CardPadding::Sm),
            "md" => Ok(CardPadding::Md),
            "lg" => Ok(CardPadding::Lg),
            "xl" => Ok(CardPadding::Xl),
            _ => Err(()),
        }
    }
class_string function · rust · L72-L109 (38 LOC)
crates/rinch-components/src/card.rs
    pub fn class_string(&self) -> String {
        let mut classes = vec!["rinch-card"];

        if !self.shadow.is_empty() {
            classes.push(match self.shadow.as_str() {
                "xs" => "rinch-card--shadow-xs",
                "sm" => "rinch-card--shadow-sm",
                "md" => "rinch-card--shadow-md",
                "lg" => "rinch-card--shadow-lg",
                "xl" => "rinch-card--shadow-xl",
                _ => "",
            });
        }

        let padding: CardPadding = if self.padding.is_empty() {
            CardPadding::default()
        } else {
            self.padding.parse().unwrap_or_default()
        };
        classes.push(padding.class_name());

        if !self.radius.is_empty() {
            classes.push(match self.radius.as_str() {
                "xs" => "rinch-card--radius-xs",
                "sm" => "rinch-card--radius-sm",
                "md" => "rinch-card--radius-md",
                "lg" => "rinch-card--radius-lg",
          
render function · rust · L113-L121 (9 LOC)
crates/rinch-components/src/card.rs
    fn render(&self, __scope: &mut RenderScope, children: &[NodeHandle]) -> NodeHandle {
        let container = rinch_macros::rsx! { div { class: "rinch-card" } };
        container.set_attribute("class", &self.class_string());

        for child in children {
            container.append_child(child);
        }
        container
    }
class_string function · rust · L134-L146 (13 LOC)
crates/rinch-components/src/card.rs
    pub fn class_string(&self) -> String {
        let mut classes = vec!["rinch-card__section"];

        if self.inherit_padding {
            classes.push("rinch-card__section--inherit-padding");
        }

        if self.with_border {
            classes.push("rinch-card__section--with-border");
        }

        classes.join(" ")
    }
Repobility · code-quality intelligence · https://repobility.com
render function · rust · L150-L158 (9 LOC)
crates/rinch-components/src/card.rs
    fn render(&self, __scope: &mut RenderScope, children: &[NodeHandle]) -> NodeHandle {
        let container = rinch_macros::rsx! { div { class: "rinch-card__section" } };
        container.set_attribute("class", &self.class_string());

        for child in children {
            container.append_child(child);
        }
        container
    }
class_string function · rust · L17-L25 (9 LOC)
crates/rinch-components/src/center.rs
    pub fn class_string(&self) -> String {
        let mut classes = vec!["rinch-center"];

        if self.inline {
            classes.push("rinch-center--inline");
        }

        classes.join(" ")
    }
render function · rust · L29-L38 (10 LOC)
crates/rinch-components/src/center.rs
    fn render(&self, __scope: &mut RenderScope, children: &[NodeHandle]) -> NodeHandle {
        let container = rinch_macros::rsx! {
            div { class: "rinch-center" }
        };
        container.set_attribute("class", &self.class_string());
        for child in children {
            container.append_child(child);
        }
        container
    }
fmt function · rust · L51-L65 (15 LOC)
crates/rinch-components/src/checkbox.rs
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.debug_struct("Checkbox")
            .field("label", &self.label)
            .field("description", &self.description)
            .field("size", &self.size)
            .field("disabled", &self.disabled)
            .field("checked", &self.checked)
            .field(
                "checked_fn",
                &self.checked_fn.as_ref().map(|_| "<reactive>"),
            )
            .field("indeterminate", &self.indeterminate)
            .field("onchange", &self.onchange.as_ref().map(|_| "<callback>"))
            .finish()
    }
base_class_string function · rust · L70-L90 (21 LOC)
crates/rinch-components/src/checkbox.rs
    fn base_class_string(&self) -> String {
        let mut classes = vec!["rinch-checkbox"];

        // Size
        if !self.size.is_empty() {
            match self.size.as_str() {
                "xs" => classes.push("rinch-checkbox--xs"),
                "sm" => classes.push("rinch-checkbox--sm"),
                "md" => classes.push("rinch-checkbox--md"),
                "lg" => classes.push("rinch-checkbox--lg"),
                _ => {}
            }
        }

        // Disabled
        if self.disabled {
            classes.push("rinch-checkbox--disabled");
        }

        classes.join(" ")
    }
class_string function · rust · L93-L99 (7 LOC)
crates/rinch-components/src/checkbox.rs
    pub fn class_string(&self) -> String {
        let mut class = self.base_class_string();
        if self.checked {
            class.push_str(" rinch-checkbox--checked");
        }
        class
    }
render function · rust · L103-L193 (91 LOC)
crates/rinch-components/src/checkbox.rs
    fn render(&self, scope: &mut RenderScope, _children: &[NodeHandle]) -> NodeHandle {
        let base_class = self.base_class_string();

        // Determine if we have a reactive checked state
        let is_checked = if let Some(ref checked_fn) = self.checked_fn {
            checked_fn()
        } else {
            self.checked
        };

        // Build the class string
        let class = if is_checked {
            format!("{} rinch-checkbox--checked", base_class)
        } else {
            base_class
        };

        // Create label container
        let label_node = scope.create_element("label");
        label_node.set_attribute("class", &class);

        // Register handler
        if let Some(cb) = &self.onchange {
            let handler_id = scope.register_handler({
                let cb = cb.clone();
                move || cb.invoke()
            });
            label_node.set_attribute("data-rid", &handler_id.to_string());
        }

        // Input element 
class_name function · rust · L21-L29 (9 LOC)
crates/rinch-components/src/close_button.rs
    pub fn class_name(&self) -> &'static str {
        match self {
            CloseButtonSize::Xs => "rinch-close-button--xs",
            CloseButtonSize::Sm => "rinch-close-button--sm",
            CloseButtonSize::Md => "rinch-close-button--md",
            CloseButtonSize::Lg => "rinch-close-button--lg",
            CloseButtonSize::Xl => "rinch-close-button--xl",
        }
    }
Open data scored by Repobility · https://repobility.com
icon_size function · rust · L32-L40 (9 LOC)
crates/rinch-components/src/close_button.rs
    pub fn icon_size(&self) -> &'static str {
        match self {
            CloseButtonSize::Xs => "12",
            CloseButtonSize::Sm => "14",
            CloseButtonSize::Md => "16",
            CloseButtonSize::Lg => "20",
            CloseButtonSize::Xl => "24",
        }
    }
from_str function · rust · L45-L55 (11 LOC)
crates/rinch-components/src/close_button.rs
    fn from_str(s: &str) -> Result<Self, Self::Err> {
        match s.to_lowercase().as_str() {
            "xs" => Ok(CloseButtonSize::Xs),
            "sm" => Ok(CloseButtonSize::Sm),
            "md" => Ok(CloseButtonSize::Md),
            "lg" => Ok(CloseButtonSize::Lg),
            "xl" => Ok(CloseButtonSize::Xl),
            _ => Err(()),
        }
    }
fmt function · rust · L85-L93 (9 LOC)
crates/rinch-components/src/close_button.rs
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.debug_struct("CloseButton")
            .field("size", &self.size)
            .field("radius", &self.radius)
            .field("disabled", &self.disabled)
            .field("icon_size", &self.icon_size)
            .field("onclick", &self.onclick.as_ref().map(|_| "<callback>"))
            .finish()
    }
class_string function · rust · L98-L126 (29 LOC)
crates/rinch-components/src/close_button.rs
    pub fn class_string(&self) -> String {
        let mut classes = vec!["rinch-close-button"];

        // Size class
        let size: CloseButtonSize = if self.size.is_empty() {
            CloseButtonSize::default()
        } else {
            self.size.parse().unwrap_or_default()
        };
        classes.push(size.class_name());

        // Radius class
        if !self.radius.is_empty() {
            match self.radius.as_str() {
                "xs" => classes.push("rinch-close-button--radius-xs"),
                "sm" => classes.push("rinch-close-button--radius-sm"),
                "md" => classes.push("rinch-close-button--radius-md"),
                "lg" => classes.push("rinch-close-button--radius-lg"),
                "xl" => classes.push("rinch-close-button--radius-xl"),
                _ => {}
            }
        }

        if self.disabled {
            classes.push("rinch-close-button--disabled");
        }

        classes.join(" ")
    }
render function · rust · L130-L154 (25 LOC)
crates/rinch-components/src/close_button.rs
    fn render(&self, __scope: &mut RenderScope, _children: &[NodeHandle]) -> NodeHandle {
        let icon_span = rinch_macros::rsx! { span { class: "rinch-icon rinch-icon--close" } };
        let container = rinch_macros::rsx! {
            button { class: "rinch-close-button", r#type: "button" }
        };
        container.set_attribute("class", &self.class_string());
        container.set_attribute("aria-label", "Close");

        if self.disabled {
            container.set_attribute("disabled", "");
        }

        container.append_child(&icon_span);

        // Click handler
        if let Some(cb) = &self.onclick {
            let handler_id = __scope.register_handler({
                let cb = cb.clone();
                move || cb.invoke()
            });
            container.set_attribute("data-rid", &handler_id.0.to_string());
        }

        container
    }
class_string function · rust · L19-L31 (13 LOC)
crates/rinch-components/src/code.rs
    pub fn class_string(&self) -> String {
        let mut classes = vec!["rinch-code"];

        if self.block {
            classes.push("rinch-code--block");
        }

        if !self.color.is_empty() && self.color == "primary" {
            classes.push("rinch-code--primary");
        }

        classes.join(" ")
    }
render function · rust · L35-L55 (21 LOC)
crates/rinch-components/src/code.rs
    fn render(&self, __scope: &mut RenderScope, children: &[NodeHandle]) -> NodeHandle {
        let class = self.class_string();

        if self.block {
            let code_elem = rinch_macros::rsx! { code {} };
            for child in children {
                code_elem.append_child(child);
            }
            let pre = rinch_macros::rsx! { pre { class: "rinch-code" } };
            pre.set_attribute("class", &class);
            pre.append_child(&code_elem);
            pre
        } else {
            let code_elem = rinch_macros::rsx! { code { class: "rinch-code" } };
            code_elem.set_attribute("class", &class);
            for child in children {
                code_elem.append_child(child);
            }
            code_elem
        }
    }
class_string function · rust · L19-L38 (20 LOC)
crates/rinch-components/src/container.rs
    pub fn class_string(&self) -> String {
        let mut classes = vec!["rinch-container"];

        if !self.size.is_empty() {
            match self.size.as_str() {
                "xs" => classes.push("rinch-container--xs"),
                "sm" => classes.push("rinch-container--sm"),
                "md" => classes.push("rinch-container--md"),
                "lg" => classes.push("rinch-container--lg"),
                "xl" => classes.push("rinch-container--xl"),
                _ => {}
            }
        }

        if self.fluid {
            classes.push("rinch-container--fluid");
        }

        classes.join(" ")
    }
Generated by Repobility's multi-pass static-analysis pipeline (https://repobility.com)
render function · rust · L42-L51 (10 LOC)
crates/rinch-components/src/container.rs
    fn render(&self, __scope: &mut RenderScope, children: &[NodeHandle]) -> NodeHandle {
        let container = rinch_macros::rsx! {
            div { class: "rinch-container" }
        };
        container.set_attribute("class", &self.class_string());
        for child in children {
            container.append_child(child);
        }
        container
    }
class_string function · rust · L23-L64 (42 LOC)
crates/rinch-components/src/divider.rs
    pub fn class_string(&self) -> String {
        let mut classes = vec!["rinch-divider"];

        // Orientation
        let orientation = if self.orientation.is_empty() {
            "horizontal"
        } else {
            &self.orientation
        };
        match orientation {
            "vertical" => classes.push("rinch-divider--vertical"),
            _ => classes.push("rinch-divider--horizontal"),
        }

        // Size (margin)
        if !self.size.is_empty() {
            match self.size.as_str() {
                "xs" => classes.push("rinch-divider--xs"),
                "sm" => classes.push("rinch-divider--sm"),
                "md" => classes.push("rinch-divider--md"),
                "lg" => classes.push("rinch-divider--lg"),
                "xl" => classes.push("rinch-divider--xl"),
                _ => {}
            }
        }

        // Label
        if !self.label.is_empty() {
            classes.push("rinch-divider--with-label");

            // Label pos
render function · rust · L68-L94 (27 LOC)
crates/rinch-components/src/divider.rs
    fn render(&self, __scope: &mut RenderScope, _children: &[NodeHandle]) -> NodeHandle {
        let class = self.class_string();
        let orientation = if self.orientation.is_empty() {
            "horizontal"
        } else {
            &self.orientation
        };

        if orientation == "vertical" {
            let container = rinch_macros::rsx! { div { class: "rinch-divider" } };
            container.set_attribute("class", &class);
            container
        } else if !self.label.is_empty() {
            let label_span = rinch_macros::rsx! { span { class: "rinch-divider__label" } };
            let text_node = __scope.create_text(&self.label);
            label_span.append_child(&text_node);

            let container = rinch_macros::rsx! { div { class: "rinch-divider" } };
            container.set_attribute("class", &class);
            container.append_child(&label_span);
            container
        } else {
            let container = rinch_macros::rsx! { hr { cl
‹ prevpage 2 / 20next ›