♻️ Rename types for Mixed and Typed components

This commit is contained in:
Manuel Cillero 2024-03-07 21:27:36 +01:00
parent 57e71a9399
commit c65ac74a6f
20 changed files with 151 additions and 154 deletions

View file

@ -1,8 +1,8 @@
use crate::core::component::{ComponentTrait, Context, TypedComponent};
use crate::core::component::{ComponentTrait, Context, OneComponent};
use crate::fn_builder;
use crate::html::{html, Markup};
pub struct OptionComponent<C: ComponentTrait>(Option<TypedComponent<C>>);
pub struct OptionComponent<C: ComponentTrait>(Option<OneComponent<C>>);
impl<C: ComponentTrait> Default for OptionComponent<C> {
fn default() -> Self {
@ -20,7 +20,7 @@ impl<C: ComponentTrait> OptionComponent<C> {
#[fn_builder]
pub fn alter_value(&mut self, component: Option<C>) -> &mut Self {
if let Some(component) = component {
self.0 = Some(TypedComponent::with(component));
self.0 = Some(OneComponent::with(component));
} else {
self.0 = None;
}
@ -29,7 +29,7 @@ impl<C: ComponentTrait> OptionComponent<C> {
// OptionComponent GETTERS.
pub fn get(&self) -> Option<TypedComponent<C>> {
pub fn get(&self) -> Option<OneComponent<C>> {
if let Some(value) = &self.0 {
return Some(value.clone());
}