summaryrefslogtreecommitdiff
path: root/src/view/mod.rs
diff options
context:
space:
mode:
authorjelemux <jeremias.weber@protonmail.com>2021-02-17 17:06:48 +0100
committerjelemux <jeremias.weber@protonmail.com>2021-02-17 17:06:48 +0100
commitcb310a66e94db4e0c4f7d0373a670156b012412a (patch)
tree501fd4ed17d892d693d4123fffaca8d942144e3b /src/view/mod.rs
parentbe3367dd2921eb30ae7970d233b83ac3af861952 (diff)
parent0660151a8b641fa0a23dde2598132029970f7ae4 (diff)
downloadwasm-card-cb310a66e94db4e0c4f7d0373a670156b012412a.tar.gz
wasm-card-cb310a66e94db4e0c4f7d0373a670156b012412a.tar.bz2
Merge branch 'main' of codeberg.org:jelemux/wasm-card
Diffstat (limited to 'src/view/mod.rs')
-rw-r--r--src/view/mod.rs82
1 files changed, 2 insertions, 80 deletions
diff --git a/src/view/mod.rs b/src/view/mod.rs
index cbff0fd..691f19a 100644
--- a/src/view/mod.rs
+++ b/src/view/mod.rs
@@ -1,81 +1,3 @@
-use crate::viewmodel::*;
-use std::cell::RefCell;
-use std::ops::Deref;
-use std::rc::Rc;
-use yew::prelude::*;
-
-pub mod address;
-pub mod dates;
pub mod main;
-pub mod name;
-pub mod organizational;
-pub mod telephone;
-
-#[derive(Clone, PartialEq, Properties)]
-pub struct InputProps<O, C>
-where
- O: VCardPropertyInputObject<C> + Clone,
- C: VCardPropertyInputComponent<O> + Clone,
-{
- pub generated: Callback<O>,
- pub weak_link: WeakComponentLink<C>,
-}
-
-/// Trait for types that represent an input component for a vcard property.
-pub trait VCardPropertyInputComponent<T: VCardPropertyInputObject<Self>>:
- Component + Clone + PartialEq
-{
- /// Returns the object containing the input data.
- fn get_input_object(&self) -> T;
- /// Getter function for the title of the component
- fn get_title(&self) -> String;
- /// Getter function for an eventual error.
- fn get_error(&self) -> Option<Error>;
- /// Returns the error as `Html`
- fn render_error(&self) -> Html {
- html! {
- <>
- {
- if self.get_error().is_some() {
- html!{
- <div class="notification is-danger is-light">
- { self.get_error().unwrap().msg }
- </div>
- }
- } else {
- html!{}
- }
- }
- </>
- }
- }
-}
-
-/// Weak link; Useful for being able to have a list of subcomponents.
-pub struct WeakComponentLink<COMP: Component>(Rc<RefCell<Option<ComponentLink<COMP>>>>);
-
-impl<COMP: Component> Clone for WeakComponentLink<COMP> {
- fn clone(&self) -> Self {
- Self(Rc::clone(&self.0))
- }
-}
-
-impl<COMP: Component> Default for WeakComponentLink<COMP> {
- fn default() -> Self {
- Self(Rc::default())
- }
-}
-
-impl<COMP: Component> Deref for WeakComponentLink<COMP> {
- type Target = Rc<RefCell<Option<ComponentLink<COMP>>>>;
-
- fn deref(&self) -> &Self::Target {
- &self.0
- }
-}
-
-impl<COMP: Component> PartialEq for WeakComponentLink<COMP> {
- fn eq(&self, other: &Self) -> bool {
- Rc::ptr_eq(&self.0, &other.0)
- }
-}
+pub mod property_group;
+pub mod weak_links;