use super::*;
#[component]
pub fn euv_chart(node: VirtualNode<EuvChartProps>) -> VirtualNode {
let EuvChartProps { id, config }: EuvChartProps = node.try_get_props().unwrap_or_default();
let mut style_text: String = String::new();
for (key, color) in config.iter() {
style_text.push_str(CHART_COLOR_VAR_PREFIX);
style_text.push_str(key);
style_text.push_str(": ");
style_text.push_str(color);
style_text.push(';');
}
let style_ref: &str = style_text.as_str();
let children: VirtualNode = node.get_children().into();
html! {
div {
"data-slot": "chart"
"data-chart": id
style: style_ref
class: c_euv_chart()
children
}
}
}
#[component]
pub fn euv_chart_container(node: VirtualNode<EuvChartContainerProps>) -> VirtualNode {
let EuvChartContainerProps { id, config }: EuvChartContainerProps =
node.try_get_props().unwrap_or_default();
let mut style_text: String = String::new();
for (key, color) in config.iter() {
style_text.push_str(CHART_COLOR_VAR_PREFIX);
style_text.push_str(key);
style_text.push_str(": ");
style_text.push_str(color);
style_text.push(';');
}
let style_ref: &str = style_text.as_str();
let children: VirtualNode = node.get_children().into();
html! {
div {
"data-slot": "chart"
"data-chart": id
style: style_ref
class: c_euv_chart_container()
children
}
}
}
#[component]
pub fn euv_chart_tooltip(node: VirtualNode<EuvChartTooltipProps>) -> VirtualNode {
let children: VirtualNode = node.get_children().into();
html! {
div {
"data-slot": "chart-tooltip"
class: c_euv_chart_tooltip()
children
}
}
}
#[component]
pub fn euv_chart_tooltip_label(node: VirtualNode<EuvChartTooltipLabelProps>) -> VirtualNode {
let children: VirtualNode = node.get_children().into();
html! {
div {
"data-slot": "chart-tooltip-label"
class: c_euv_chart_tooltip_label()
children
}
}
}
#[component]
pub fn euv_chart_tooltip_content(node: VirtualNode<EuvChartTooltipContentProps>) -> VirtualNode {
let EuvChartTooltipContentProps {}: EuvChartTooltipContentProps =
node.try_get_props().unwrap_or_default();
let children: VirtualNode = node.get_children().into();
html! {
div {
"data-slot": "chart-tooltip-content"
class: c_euv_chart_tooltip_content()
children
}
}
}
#[component]
pub fn euv_chart_tooltip_item(node: VirtualNode<EuvChartTooltipItemProps>) -> VirtualNode {
let EuvChartTooltipItemProps { name, value, color }: EuvChartTooltipItemProps =
node.try_get_props().unwrap_or_default();
let indicator_style: String = format!("background: {};", color);
let indicator_ref: &str = indicator_style.as_str();
html! {
div {
"data-slot": "chart-tooltip-item"
class: c_euv_chart_tooltip_item()
span {
"data-slot": "chart-indicator"
"aria-hidden": "true"
style: indicator_ref
class: c_euv_chart_indicator()
}
span {
"data-slot": "chart-tooltip-name"
name
}
span {
"data-slot": "chart-tooltip-value"
value
}
}
}
}
#[component]
pub fn euv_chart_legend(node: VirtualNode<EuvChartLegendProps>) -> VirtualNode {
let children: VirtualNode = node.get_children().into();
html! {
div {
"data-slot": "chart-legend"
class: c_euv_chart_legend()
children
}
}
}
#[component]
pub fn euv_chart_legend_item(node: VirtualNode<EuvChartLegendItemProps>) -> VirtualNode {
let EuvChartLegendItemProps { label, color }: EuvChartLegendItemProps =
node.try_get_props().unwrap_or_default();
let indicator_style: String = format!("background: {};", color);
let indicator_ref: &str = indicator_style.as_str();
html! {
div {
"data-slot": "chart-legend-item"
class: c_euv_chart_legend_item()
span {
"data-slot": "chart-indicator"
"aria-hidden": "true"
style: indicator_ref
class: c_euv_chart_indicator()
}
span {
"data-slot": "chart-legend-label"
label
}
}
}
}
#[component]
pub fn euv_chart_legend_content(node: VirtualNode<EuvChartLegendContentProps>) -> VirtualNode {
let EuvChartLegendContentProps {}: EuvChartLegendContentProps =
node.try_get_props().unwrap_or_default();
let children: VirtualNode = node.get_children().into();
html! {
div {
"data-slot": "chart-legend-content"
class: c_euv_chart_legend_content()
children
}
}
}