Function bodies 1,000 total
fmt function · rust · L56-L63 (8 LOC)crates/rinch-clipboard/src/lib.rs
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
ClipboardError::AccessFailed(msg) => write!(f, "clipboard access failed: {}", msg),
ClipboardError::ContentTypeMismatch => write!(f, "clipboard content type mismatch"),
ClipboardError::NotSupported => write!(f, "clipboard operation not supported"),
ClipboardError::NotAvailable => write!(f, "clipboard not available"),
}
}new function · rust · L86-L92 (7 LOC)crates/rinch-clipboard/src/lib.rs
pub fn new(width: usize, height: usize, bytes: impl Into<Cow<'a, [u8]>>) -> Self {
Self {
width,
height,
bytes: bytes.into(),
}
}into_owned function · rust · L95-L101 (7 LOC)crates/rinch-clipboard/src/lib.rs
pub fn into_owned(self) -> ImageData<'static> {
ImageData {
width: self.width,
height: self.height,
bytes: Cow::Owned(self.bytes.into_owned()),
}
}with_clipboard function · rust · L16-L23 (8 LOC)crates/rinch-clipboard/src/native.rs
fn with_clipboard<T, F: FnOnce(&mut Clipboard) -> ClipboardResult<T>>(f: F) -> ClipboardResult<T> {
let mut guard = CLIPBOARD.lock().unwrap();
if guard.is_none() {
*guard = Some(Clipboard::new()?);
}
f(guard.as_mut().unwrap())
}copy_text function · rust · L26-L31 (6 LOC)crates/rinch-clipboard/src/native.rs
pub fn copy_text(text: impl AsRef<str>) -> ClipboardResult<()> {
with_clipboard(|clipboard| {
clipboard.set_text(text.as_ref())?;
Ok(())
})
}paste_text function · rust · L36-L41 (6 LOC)crates/rinch-clipboard/src/native.rs
pub fn paste_text() -> ClipboardResult<String> {
with_clipboard(|clipboard| {
let text = clipboard.get_text()?;
Ok(text)
})
}clear function · rust · L49-L54 (6 LOC)crates/rinch-clipboard/src/native.rs
pub fn clear() -> ClipboardResult<()> {
with_clipboard(|clipboard| {
clipboard.clear()?;
Ok(())
})
}Powered by Repobility — scan your code at https://repobility.com
copy_image function · rust · L59-L69 (11 LOC)crates/rinch-clipboard/src/native.rs
pub fn copy_image(image: ImageData) -> ClipboardResult<()> {
with_clipboard(|clipboard| {
let arboard_image = arboard::ImageData {
width: image.width,
height: image.height,
bytes: image.bytes,
};
clipboard.set_image(arboard_image)?;
Ok(())
})
}paste_image function · rust · L74-L83 (10 LOC)crates/rinch-clipboard/src/native.rs
pub fn paste_image() -> ClipboardResult<ImageData<'static>> {
with_clipboard(|clipboard| {
let image = clipboard.get_image()?;
Ok(ImageData {
width: image.width,
height: image.height,
bytes: image.bytes,
})
})
}copy_html function · rust · L95-L100 (6 LOC)crates/rinch-clipboard/src/native.rs
pub fn copy_html(html: impl AsRef<str>, alt_text: Option<&str>) -> ClipboardResult<()> {
with_clipboard(|clipboard| {
clipboard.set_html(html.as_ref(), alt_text)?;
Ok(())
})
}paste_html function · rust · L106-L117 (12 LOC)crates/rinch-clipboard/src/native.rs
pub fn paste_html() -> ClipboardResult<String> {
with_clipboard(|clipboard| {
let html = clipboard.get().html().map_err(|e| {
// arboard returns ContentNotAvailable when no HTML on clipboard
match e {
arboard::Error::ContentNotAvailable => ClipboardError::ContentTypeMismatch,
other => ClipboardError::AccessFailed(other.to_string()),
}
})?;
Ok(html)
})
}copy_text function · rust · L22-L43 (22 LOC)crates/rinch-clipboard/src/web.rs
pub fn copy_text(text: impl AsRef<str>) -> ClipboardResult<()> {
let text = text.as_ref().to_string();
// Always store locally for synchronous paste_text() to work
CLIPBOARD_BUFFER.with(|buf| {
*buf.borrow_mut() = Some(text.clone());
});
// Also try to write to the system clipboard (fire-and-forget)
if let Some(window) = web_sys::window() {
if let Ok(navigator) = js_sys::Reflect::get(&window, &"navigator".into()) {
if let Ok(clipboard) = js_sys::Reflect::get(&navigator, &"clipboard".into()) {
if !clipboard.is_undefined() {
let clipboard: web_sys::Clipboard = clipboard.into();
let _ = clipboard.write_text(&text);
}
}
}
}
Ok(())
}paste_text function · rust · L50-L56 (7 LOC)crates/rinch-clipboard/src/web.rs
pub fn paste_text() -> ClipboardResult<String> {
CLIPBOARD_BUFFER.with(|buf| {
buf.borrow()
.clone()
.ok_or(ClipboardError::ContentTypeMismatch)
})
}clear function · rust · L64-L69 (6 LOC)crates/rinch-clipboard/src/web.rs
pub fn clear() -> ClipboardResult<()> {
CLIPBOARD_BUFFER.with(|buf| {
*buf.borrow_mut() = None;
});
Ok(())
}copy_html function · rust · L93-L126 (34 LOC)crates/rinch-clipboard/src/web.rs
pub fn copy_html(html: impl AsRef<str>, alt_text: Option<&str>) -> ClipboardResult<()> {
let html = html.as_ref().to_string();
// Store HTML locally
HTML_CLIPBOARD_BUFFER.with(|buf| {
*buf.borrow_mut() = Some(html.clone());
});
// Also store plain text version
if let Some(text) = alt_text {
CLIPBOARD_BUFFER.with(|buf| {
*buf.borrow_mut() = Some(text.to_string());
});
}
// Try to write to system clipboard (fire-and-forget)
// Note: browser Clipboard API doesn't have a simple setHtml, but we can
// use ClipboardItem with text/html blob for modern browsers
if let Some(window) = web_sys::window() {
if let Ok(navigator) = js_sys::Reflect::get(&window, &"navigator".into()) {
if let Ok(clipboard) = js_sys::Reflect::get(&navigator, &"clipboard".into()) {
if !clipboard.is_undefined() {
// Fall back to writing plain text for broad compatibility
Want fix-PRs on findings? Install Repobility's GitHub App · github.com/apps/repobility-bot
paste_html function · rust · L131-L137 (7 LOC)crates/rinch-clipboard/src/web.rs
pub fn paste_html() -> ClipboardResult<String> {
HTML_CLIPBOARD_BUFFER.with(|buf| {
buf.borrow()
.clone()
.ok_or(ClipboardError::ContentTypeMismatch)
})
}class_name function · rust · L20-L27 (8 LOC)crates/rinch-components/src/accordion.rs
pub fn class_name(&self) -> &'static str {
match self {
AccordionVariant::Default => "rinch-accordion--default",
AccordionVariant::Contained => "rinch-accordion--contained",
AccordionVariant::Filled => "rinch-accordion--filled",
AccordionVariant::Separated => "rinch-accordion--separated",
}
}from_str function · rust · L32-L40 (9 LOC)crates/rinch-components/src/accordion.rs
fn from_str(s: &str) -> Result<Self, Self::Err> {
match s.to_lowercase().as_str() {
"default" => Ok(AccordionVariant::Default),
"contained" => Ok(AccordionVariant::Contained),
"filled" => Ok(AccordionVariant::Filled),
"separated" => Ok(AccordionVariant::Separated),
_ => Err(()),
}
}from_str function · rust · L53-L59 (7 LOC)crates/rinch-components/src/accordion.rs
fn from_str(s: &str) -> Result<Self, Self::Err> {
match s.to_lowercase().as_str() {
"left" => Ok(ChevronPosition::Left),
"right" => Ok(ChevronPosition::Right),
_ => Err(()),
}
}class_string function · rust · L99-L128 (30 LOC)crates/rinch-components/src/accordion.rs
pub fn class_string(&self) -> String {
let mut classes = vec!["rinch-accordion"];
if !self.variant.is_empty() {
if let Ok(variant) = self.variant.parse::<AccordionVariant>() {
classes.push(variant.class_name());
}
} else {
classes.push(AccordionVariant::Default.class_name());
}
if !self.radius.is_empty() {
match self.radius.as_str() {
"xs" => classes.push("rinch-accordion--radius-xs"),
"sm" => classes.push("rinch-accordion--radius-sm"),
"md" => classes.push("rinch-accordion--radius-md"),
"lg" => classes.push("rinch-accordion--radius-lg"),
"xl" => classes.push("rinch-accordion--radius-xl"),
_ => {}
}
}
if !self.chevron_position.is_empty()
&& let Ok(ChevronPosition::Left) = self.chevron_position.parse()
{
classes.push("rinch-render function · rust · L132-L154 (23 LOC)crates/rinch-components/src/accordion.rs
fn render(&self, __scope: &mut RenderScope, children: &[NodeHandle]) -> NodeHandle {
let container = rinch_macros::rsx! { div { class: "rinch-accordion" } };
container.set_attribute("class", &self.class_string());
let active_value = if !self.value.is_empty() {
&self.value
} else {
&self.default_value
};
if !active_value.is_empty() {
container.set_attribute("data-active-item", active_value);
}
if self.multiple {
container.set_attribute("data-multiple", "true");
}
for child in children {
container.append_child(child);
}
container
}render function · rust · L165-L177 (13 LOC)crates/rinch-components/src/accordion.rs
fn render(&self, __scope: &mut RenderScope, children: &[NodeHandle]) -> NodeHandle {
let item = rinch_macros::rsx! { div { class: "rinch-accordion__item" } };
if !self.value.is_empty() {
item.set_attribute("data-item-value", &self.value);
}
for child in children {
item.append_child(child);
}
item
}fmt function · rust · L192-L197 (6 LOC)crates/rinch-components/src/accordion.rs
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.debug_struct("AccordionControl")
.field("disabled", &self.disabled)
.field("icon", &self.icon)
.finish_non_exhaustive()
}Open data scored by Repobility · https://repobility.com
render function · rust · L201-L245 (45 LOC)crates/rinch-components/src/accordion.rs
fn render(&self, __scope: &mut RenderScope, children: &[NodeHandle]) -> NodeHandle {
let mut classes = vec!["rinch-accordion__control"];
if self.disabled {
classes.push("rinch-accordion__control--disabled");
}
let btn = rinch_macros::rsx! { button { class: "rinch-accordion__control" } };
btn.set_attribute("class", &classes.join(" "));
// Mark this as an accordion toggle - the shell will handle DOM toggle
btn.set_attribute("data-accordion-toggle", "true");
if self.disabled {
btn.set_attribute("disabled", "");
}
// Register click handler if provided
if let Some(ref cb) = self.onclick
&& !self.disabled
{
let handler_id = __scope.register_handler({
let cb = cb.clone();
move || cb.invoke()
});
btn.set_attribute("data-rid", &handler_id.0.to_string());
}
// Label span
render function · rust · L253-L264 (12 LOC)crates/rinch-components/src/accordion.rs
fn render(&self, __scope: &mut RenderScope, children: &[NodeHandle]) -> NodeHandle {
let panel = rinch_macros::rsx! { div { class: "rinch-accordion__panel" } };
let content = rinch_macros::rsx! { div { class: "rinch-accordion__content" } };
for child in children {
content.append_child(child);
}
panel.append_child(&content);
panel
}class_name function · rust · L29-L38 (10 LOC)crates/rinch-components/src/action_icon.rs
pub fn class_name(&self) -> &'static str {
match self {
ActionIconVariant::Filled => "rinch-action-icon--filled",
ActionIconVariant::Light => "rinch-action-icon--light",
ActionIconVariant::Outline => "rinch-action-icon--outline",
ActionIconVariant::Subtle => "rinch-action-icon--subtle",
ActionIconVariant::Transparent => "rinch-action-icon--transparent",
ActionIconVariant::Default => "rinch-action-icon--default",
}
}from_str function · rust · L43-L54 (12 LOC)crates/rinch-components/src/action_icon.rs
fn from_str(s: &str) -> Result<Self, Self::Err> {
match s.to_lowercase().as_str() {
"filled" => Ok(ActionIconVariant::Filled),
"light" => Ok(ActionIconVariant::Light),
"outline" => Ok(ActionIconVariant::Outline),
"subtle" => Ok(ActionIconVariant::Subtle),
"transparent" => Ok(ActionIconVariant::Transparent),
"default" => Ok(ActionIconVariant::Default),
_ => Err(()),
}
}class_name function · rust · L70-L78 (9 LOC)crates/rinch-components/src/action_icon.rs
pub fn class_name(&self) -> &'static str {
match self {
ActionIconSize::Xs => "rinch-action-icon--xs",
ActionIconSize::Sm => "rinch-action-icon--sm",
ActionIconSize::Md => "rinch-action-icon--md",
ActionIconSize::Lg => "rinch-action-icon--lg",
ActionIconSize::Xl => "rinch-action-icon--xl",
}
}icon_size function · rust · L81-L89 (9 LOC)crates/rinch-components/src/action_icon.rs
pub fn icon_size(&self) -> &'static str {
match self {
ActionIconSize::Xs => "12",
ActionIconSize::Sm => "14",
ActionIconSize::Md => "18",
ActionIconSize::Lg => "22",
ActionIconSize::Xl => "28",
}
}from_str function · rust · L94-L104 (11 LOC)crates/rinch-components/src/action_icon.rs
fn from_str(s: &str) -> Result<Self, Self::Err> {
match s.to_lowercase().as_str() {
"xs" => Ok(ActionIconSize::Xs),
"sm" => Ok(ActionIconSize::Sm),
"md" => Ok(ActionIconSize::Md),
"lg" => Ok(ActionIconSize::Lg),
"xl" => Ok(ActionIconSize::Xl),
_ => Err(()),
}
}class_string function · rust · L141-L181 (41 LOC)crates/rinch-components/src/action_icon.rs
pub fn class_string(&self) -> String {
let mut classes = vec!["rinch-action-icon"];
// Variant class
let variant: ActionIconVariant = if self.variant.is_empty() {
ActionIconVariant::default()
} else {
self.variant.parse().unwrap_or_default()
};
classes.push(variant.class_name());
// Size class
let size: ActionIconSize = if self.size.is_empty() {
ActionIconSize::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-action-icon--radius-xs"),
"sm" => classes.push("rinch-action-icon--radius-sm"),
"md" => classes.push("rinch-action-icon--radius-md"),
"lg" => classes.push("rinch-action-icon--radius-lg"),
"xGenerated by Repobility's multi-pass static-analysis pipeline (https://repobility.com)
render function · rust · L185-L240 (56 LOC)crates/rinch-components/src/action_icon.rs
fn render(&self, __scope: &mut RenderScope, children: &[NodeHandle]) -> NodeHandle {
let container =
rinch_macros::rsx! { button { class: "rinch-action-icon", r#type: "button" } };
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-action-icon-color: {}", c)
} else {
format!("--rinch-action-icon-color: var(--rinch-color-{}-6)", c)
};
container.set_attribute("style", &style);
}
if self.disabled {
container.set_attribute("disabled", "");
}
// Register click handler
if let Some(cb) = &self.onclick {
let handler_id = __scope.register_handler({
let cb = cb.clone();
move || cb.invoke()
class_name function · rust · L23-L29 (7 LOC)crates/rinch-components/src/alert.rs
pub fn class_name(&self) -> &'static str {
match self {
AlertVariant::Light => "rinch-alert--light",
AlertVariant::Filled => "rinch-alert--filled",
AlertVariant::Outline => "rinch-alert--outline",
}
}from_str function · rust · L34-L42 (9 LOC)crates/rinch-components/src/alert.rs
fn from_str(s: &str) -> Result<Self, Self::Err> {
match s.to_lowercase().as_str() {
"light" => Ok(AlertVariant::Light),
"filled" => Ok(AlertVariant::Filled),
"outline" => Ok(AlertVariant::Outline),
_ => Err(()),
}
}class_name function · rust · L65-L74 (10 LOC)crates/rinch-components/src/alert.rs
pub fn class_name(&self) -> &'static str {
match self {
AlertColor::Blue => "rinch-alert--blue",
AlertColor::Green => "rinch-alert--green",
AlertColor::Yellow => "rinch-alert--yellow",
AlertColor::Red => "rinch-alert--red",
AlertColor::Gray => "rinch-alert--gray",
AlertColor::Primary => "rinch-alert--primary",
}
}from_str function · rust · L79-L90 (12 LOC)crates/rinch-components/src/alert.rs
fn from_str(s: &str) -> Result<Self, Self::Err> {
match s.to_lowercase().as_str() {
"blue" | "info" => Ok(AlertColor::Blue),
"green" | "success" => Ok(AlertColor::Green),
"yellow" | "warning" => Ok(AlertColor::Yellow),
"red" | "error" => Ok(AlertColor::Red),
"gray" => Ok(AlertColor::Gray),
"primary" => Ok(AlertColor::Primary),
_ => Err(()),
}
}class_name function · rust · L106-L114 (9 LOC)crates/rinch-components/src/alert.rs
pub fn class_name(&self) -> &'static str {
match self {
AlertRadius::Xs => "rinch-alert--radius-xs",
AlertRadius::Sm => "rinch-alert--radius-sm",
AlertRadius::Md => "rinch-alert--radius-md",
AlertRadius::Lg => "rinch-alert--radius-lg",
AlertRadius::Xl => "rinch-alert--radius-xl",
}
}from_str function · rust · L119-L129 (11 LOC)crates/rinch-components/src/alert.rs
fn from_str(s: &str) -> Result<Self, Self::Err> {
match s.to_lowercase().as_str() {
"xs" => Ok(AlertRadius::Xs),
"sm" => Ok(AlertRadius::Sm),
"md" => Ok(AlertRadius::Md),
"lg" => Ok(AlertRadius::Lg),
"xl" => Ok(AlertRadius::Xl),
_ => Err(()),
}
}fmt function · rust · L167-L177 (11 LOC)crates/rinch-components/src/alert.rs
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.debug_struct("Alert")
.field("color", &self.color)
.field("variant", &self.variant)
.field("title", &self.title)
.field("radius", &self.radius)
.field("with_close_button", &self.with_close_button)
.field("icon", &self.icon)
.field("onclose", &self.onclose.as_ref().map(|_| "<callback>"))
.finish()
}Powered by Repobility — scan your code at https://repobility.com
class_string function · rust · L182-L219 (38 LOC)crates/rinch-components/src/alert.rs
pub fn class_string(&self) -> String {
let mut classes = vec!["rinch-alert"];
// Variant class
let variant: AlertVariant = if self.variant.is_empty() {
AlertVariant::default()
} else {
self.variant.parse().unwrap_or_default()
};
classes.push(variant.class_name());
// Color class
let color: AlertColor = if self.color.is_empty() {
AlertColor::default()
} else {
self.color.parse().unwrap_or_default()
};
classes.push(color.class_name());
// Radius class (only if non-default)
if !self.radius.is_empty() {
if let Ok(radius) = self.radius.parse::<AlertRadius>() {
classes.push(radius.class_name());
}
}
// With title
if !self.title.is_empty() {
classes.push("rinch-alert--with-title");
}
// With icon
if self.icon.is_some() {
clarender function · rust · L223-L275 (53 LOC)crates/rinch-components/src/alert.rs
fn render(&self, __scope: &mut RenderScope, children: &[NodeHandle]) -> NodeHandle {
let container = rinch_macros::rsx! { div { class: "rinch-alert" } };
container.set_attribute("class", &self.class_string());
// Icon
if let Some(icon) = &self.icon {
let icon_div = rinch_macros::rsx! { div { class: "rinch-alert__icon" } };
let icon_svg = render_tabler_icon(__scope, *icon, TablerIconStyle::Outline);
icon_div.append_child(&icon_svg);
container.append_child(&icon_div);
}
// Wrapper for content
let wrapper = rinch_macros::rsx! { div { class: "rinch-alert__wrapper" } };
// Title
if !self.title.is_empty() {
let title_div = rinch_macros::rsx! { div { class: "rinch-alert__title" } };
let title_text = __scope.create_text(&self.title);
title_div.append_child(&title_text);
wrapper.append_child(&title_div);
}
class_string function · rust · L23-L41 (19 LOC)crates/rinch-components/src/anchor.rs
pub fn class_string(&self) -> String {
let mut classes = vec!["rinch-anchor"];
if !self.size.is_empty() {
match self.size.as_str() {
"xs" => classes.push("rinch-anchor--xs"),
"sm" => classes.push("rinch-anchor--sm"),
"md" => classes.push("rinch-anchor--md"),
"lg" => classes.push("rinch-anchor--lg"),
_ => {}
}
}
if self.underline {
classes.push("rinch-anchor--underline");
}
classes.join(" ")
}render function · rust · L45-L63 (19 LOC)crates/rinch-components/src/anchor.rs
fn render(&self, __scope: &mut RenderScope, children: &[NodeHandle]) -> NodeHandle {
let container = rinch_macros::rsx! { a { class: "rinch-anchor" } };
container.set_attribute("class", &self.class_string());
let href = if self.href.is_empty() {
"#"
} else {
&self.href
};
container.set_attribute("href", href);
if !self.target.is_empty() {
container.set_attribute("target", &self.target);
}
for child in children {
container.append_child(child);
}
container
}class_name function · rust · L20-L28 (9 LOC)crates/rinch-components/src/avatar.rs
pub fn class_name(&self) -> &'static str {
match self {
AvatarSize::Xs => "rinch-avatar--xs",
AvatarSize::Sm => "rinch-avatar--sm",
AvatarSize::Md => "rinch-avatar--md",
AvatarSize::Lg => "rinch-avatar--lg",
AvatarSize::Xl => "rinch-avatar--xl",
}
}from_str function · rust · L33-L42 (10 LOC)crates/rinch-components/src/avatar.rs
fn from_str(s: &str) -> Result<Self, Self::Err> {
match s.to_lowercase().as_str() {
"xs" => Ok(AvatarSize::Xs),
"sm" => Ok(AvatarSize::Sm),
"md" => Ok(AvatarSize::Md),
"lg" => Ok(AvatarSize::Lg),
"xl" => Ok(AvatarSize::Xl),
_ => Err(()),
}
}class_name function · rust · L57-L65 (9 LOC)crates/rinch-components/src/avatar.rs
pub fn class_name(&self) -> &'static str {
match self {
AvatarRadius::Xs => "rinch-avatar--radius-xs",
AvatarRadius::Sm => "rinch-avatar--radius-sm",
AvatarRadius::Md => "rinch-avatar--radius-md",
AvatarRadius::Lg => "rinch-avatar--radius-lg",
AvatarRadius::Xl => "rinch-avatar--radius-xl",
}
}from_str function · rust · L70-L79 (10 LOC)crates/rinch-components/src/avatar.rs
fn from_str(s: &str) -> Result<Self, Self::Err> {
match s.to_lowercase().as_str() {
"xs" => Ok(AvatarRadius::Xs),
"sm" => Ok(AvatarRadius::Sm),
"md" => Ok(AvatarRadius::Md),
"lg" => Ok(AvatarRadius::Lg),
"xl" => Ok(AvatarRadius::Xl),
_ => Err(()),
}
}Want fix-PRs on findings? Install Repobility's GitHub App · github.com/apps/repobility-bot
class_name function · rust · L92-L98 (7 LOC)crates/rinch-components/src/avatar.rs
pub fn class_name(&self) -> &'static str {
match self {
AvatarVariant::Filled => "rinch-avatar--filled",
AvatarVariant::Light => "rinch-avatar--light",
AvatarVariant::Outline => "rinch-avatar--outline",
}
}from_str function · rust · L103-L110 (8 LOC)crates/rinch-components/src/avatar.rs
fn from_str(s: &str) -> Result<Self, Self::Err> {
match s.to_lowercase().as_str() {
"filled" => Ok(AvatarVariant::Filled),
"light" => Ok(AvatarVariant::Light),
"outline" => Ok(AvatarVariant::Outline),
_ => Err(()),
}
}class_string function · rust · L145-L170 (26 LOC)crates/rinch-components/src/avatar.rs
pub fn class_string(&self) -> String {
let mut classes = vec!["rinch-avatar"];
let size: AvatarSize = if self.size.is_empty() {
AvatarSize::default()
} else {
self.size.parse().unwrap_or_default()
};
classes.push(size.class_name());
let radius: AvatarRadius = if self.radius.is_empty() {
AvatarRadius::default()
} else {
self.radius.parse().unwrap_or_default()
};
classes.push(radius.class_name());
let variant: AvatarVariant = if self.variant.is_empty() {
AvatarVariant::default()
} else {
self.variant.parse().unwrap_or_default()
};
classes.push(variant.class_name());
classes.join(" ")
}page 1 / 20next ›