Browse Source

Upgrade yew, fix regressions.

main
Thomas Gideon 2 years ago
parent
commit
d19f9051c2
  1. 8
      Cargo.toml
  2. 2
      src/alert/mod.rs
  3. 5
      src/breadcrumb/item.rs
  4. 2
      src/breadcrumb/mod.rs
  5. 2
      src/button/mod.rs
  6. 1
      src/card/body.rs
  7. 1
      src/card/header.rs
  8. 1
      src/container.rs
  9. 27
      src/input/textarea.rs
  10. 2
      src/jumbotron.rs
  11. 4
      src/render.rs

8
Cargo.toml

@ -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"

2
src/alert/mod.rs

@ -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"

5
src/breadcrumb/item.rs

@ -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());

2
src/breadcrumb/mod.rs

@ -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>
};

2
src/button/mod.rs

@ -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)

1
src/card/body.rs

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

1
src/card/header.rs

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

1
src/container.rs

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

27
src/input/textarea.rs

@ -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
})
}
}

2
src/jumbotron.rs

@ -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)

4
src/render.rs

@ -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>
}
}

Loading…
Cancel
Save