Upgrade yew, fix regressions.

This commit is contained in:
Thomas Gideon 2020-07-22 16:50:09 -04:00
parent 404aff275a
commit d19f9051c2
11 changed files with 26 additions and 29 deletions

View file

@ -1,6 +1,6 @@
[package]
name = "bootstrap-rs"
version = "0.2.11"
version = "0.2.12"
authors = ["Thomas Gideon <cmdln@thecommandline.net>"]
edition = "2018"
@ -8,7 +8,7 @@ edition = "2018"
crate-type = ["cdylib", "rlib"]
[dependencies]
yew = "~0.16.2"
yew = "~0.17.2"
log = "~0.4.8"
serde_json = "^1.0.40"
serde = "^1.0.98"
@ -16,5 +16,5 @@ anyhow = "^1.0.28"
wasm-bindgen = "~0.2.61"
web-sys = "~0.3.38"
wasm-logger = "~0.2.0"
yew-router = "~0.13.0"
yew-components = "~0.1.2"
yew-router = "~0.14.0"
yew-components = "~0.2.0"

View file

@ -29,7 +29,7 @@ impl Component for Alert {
fn view(&self) -> Html {
let html = html! {
<div>
{ self.props.children.render() }
{ self.props.children.clone() }
<button
type="button"
class="close"

View file

@ -58,7 +58,7 @@ impl Component for BreadcrumbItem {
vec!["breadcrumb-item", "active"],
html! {
<li class=self.classes() aria-current="page">
{ self.props.children.render() }
{ self.props.children.clone() }
</li>
},
)
@ -67,7 +67,7 @@ impl Component for BreadcrumbItem {
vec!["breadcrumb-item"],
html! {
<li class=self.classes()>
{ self.props.children.render() }
{ self.props.children.clone() }
</li>
},
)
@ -131,7 +131,6 @@ mod tests {
aria-current="page"
id="test"
>
<></>
</li>
};
assert_eq!(expected, item.view());

View file

@ -28,7 +28,7 @@ impl Component for Breadcrumb {
let html = html! {
<nav aria-label="breadcrumb">
<ol class="breadcrumb">
{ self.props.children.render() }
{ self.props.children.clone() }
</ol>
</nav>
};

View file

@ -61,7 +61,7 @@ impl Component for Button {
onclick=self.link.callback(|_| ())
disabled=self.props.disabled.unwrap_or_default()
>
{ self.props.children.render() }
{ self.props.children.clone() }
</button>
};
render::render_with_prefix(&self.props, self.calculate_prefix(), html)

View file

@ -41,7 +41,6 @@ mod test {
let expected = html! {
<div class="card-body" style="display: none;">
<></>
</div>
};

View file

@ -38,7 +38,6 @@ mod test {
let expected = html! {
<p class="card-header">
<></>
</p>
};

View file

@ -41,7 +41,6 @@ mod tests {
};
let expected = html! {
<div class="container m-3 pt-3">
<></>
</div>
};
assert_eq!(expected, container.view());

View file

@ -56,18 +56,19 @@ fn extract_state(props: &Props) -> String {
if props.children.is_empty() {
props.value.clone()
} else {
let node = props.children.render();
if let VNode::VText(text) = node {
text.text
} else if let VNode::VList(list) = node {
list.iter().fold(String::new(), |mut buf, node| {
if let VNode::VText(text) = node {
buf.push_str(&text.text)
}
buf
})
} else {
props.value.clone()
}
props.children.iter().fold(String::new(), |mut buf, node| {
if let VNode::VText(text) = node {
buf.push_str(&text.text);
} else if let VNode::VList(list) = node {
let text = list.iter().fold(String::new(), |mut buf, node| {
if let VNode::VText(text) = node {
buf.push_str(&text.text)
}
buf
});
buf.push_str(&text);
}
buf
})
}
}

View file

@ -24,7 +24,7 @@ impl Component for Jumbotron {
fn view(&self) -> Html {
let html = html! {
<div>
{ self.props.children.render() }
{ self.props.children.clone() }
</div>
};
render::render_with_prefix(&self.props, "jumbotron", html)

View file

@ -20,7 +20,7 @@ pub(crate) fn render_with_prefix<'a, B: Into<BootstrapProps<'a>>, C: Into<Classe
pub(crate) fn div(children: &Children) -> Html {
html! {
<div>
{ children.render() }
{ for children.iter() }
</div>
}
}
@ -28,7 +28,7 @@ pub(crate) fn div(children: &Children) -> Html {
pub(crate) fn p(children: &Children) -> Html {
html! {
<p>
{ children.render() }
{ for children.iter() }
</p>
}
}