Skip to content

Commit

Permalink
update property syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
bakape committed Jul 18, 2021
1 parent e9036e7 commit 06a0402
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 31 deletions.
30 changes: 15 additions & 15 deletions frameworks/keyed/yew-baseline/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,18 +155,18 @@ impl Component for Model {
.iter()
.map(|row| {
html! {
<Row key=row.id
data=row.clone()
selected=self.selected_id == Some(row.id)
on_select=self.on_select.clone()
on_remove=self.on_remove.clone() />
<Row key={row.id}
data={row.clone()}
selected={self.selected_id == Some(row.id)}
on_select={self.on_select.clone()}
on_remove={self.on_remove.clone()} />
}
})
.collect();

html! {
<div class="container">
<Jumbotron link=self.link.clone() />
<Jumbotron link={self.link.clone()} />
<table class="table table-hover table-striped test-data">
<tbody id="tbody">
{ rows }
Expand Down Expand Up @@ -213,22 +213,22 @@ impl Component for Jumbotron {
<div class="col-md-6">
<div class="row">
<div class="col-sm-6 smallpad">
<button type="button" id="run" class="btn btn-primary btn-block" onclick=self.link.callback(|_| Msg::Run(1_000))>{ "Create 1,000 rows" }</button>
<button type="button" id="run" class="btn btn-primary btn-block" onclick={self.link.callback(|_| Msg::Run(1_000))}>{ "Create 1,000 rows" }</button>
</div>
<div class="col-sm-6 smallpad">
<button type="button" class="btn btn-primary btn-block" onclick=self.link.callback(|_| Msg::Run(10_000)) id="runlots">{ "Create 10,000 rows" }</button>
<button type="button" class="btn btn-primary btn-block" onclick={self.link.callback(|_| Msg::Run(10_000))} id="runlots">{ "Create 10,000 rows" }</button>
</div>
<div class="col-sm-6 smallpad">
<button type="button" class="btn btn-primary btn-block" onclick=self.link.callback(|_| Msg::Add(1_000)) id="add">{ "Append 1,000 rows" }</button>
<button type="button" class="btn btn-primary btn-block" onclick={self.link.callback(|_| Msg::Add(1_000))} id="add">{ "Append 1,000 rows" }</button>
</div>
<div class="col-sm-6 smallpad">
<button type="button" class="btn btn-primary btn-block" onclick=self.link.callback(|_| Msg::Update(10)) id="update">{ "Update every 10th row" }</button>
<button type="button" class="btn btn-primary btn-block" onclick={self.link.callback(|_| Msg::Update(10))} id="update">{ "Update every 10th row" }</button>
</div>
<div class="col-sm-6 smallpad">
<button type="button" class="btn btn-primary btn-block" onclick=self.link.callback(|_| Msg::Clear) id="clear">{ "Clear" }</button>
<button type="button" class="btn btn-primary btn-block" onclick={self.link.callback(|_| Msg::Clear)} id="clear">{ "Clear" }</button>
</div>
<div class="col-sm-6 smallpad">
<button type="button" class="btn btn-primary btn-block" onclick=self.link.callback(|_| Msg::Swap) id="swaprows">{ "Swap Rows" }</button>
<button type="button" class="btn btn-primary btn-block" onclick={self.link.callback(|_| Msg::Swap)} id="swaprows">{ "Swap Rows" }</button>
</div>
</div>
</div>
Expand Down Expand Up @@ -293,13 +293,13 @@ impl Component for Row {

fn view(&self) -> Html {
html! {
<tr class=if self.props.selected { "danger" } else { "" }>
<tr class={if self.props.selected { Some("danger") } else { None }}>
<td class="col-md-1">{ self.props.data.id }</td>
<td class="col-md-4" onclick=self.state.on_select.clone()>
<td class="col-md-4" onclick={self.state.on_select.clone()}>
<a class="lbl">{ self.props.data.label.clone() }</a>
</td>
<td class="col-md-1">
<a class="remove" onclick=self.state.on_remove.clone()>
<a class="remove" onclick={self.state.on_remove.clone()}>
<span class="glyphicon glyphicon-remove remove" aria-hidden="true"></span>
</a>
</td>
Expand Down
2 changes: 1 addition & 1 deletion frameworks/keyed/yew/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ rand = {version = "0.7.3", features = ["wasm-bindgen", "small_rng"]}
wasm-bindgen = "0.2.62"

# UPDATE TO USE YOUR BRANCH
yew = {path = "PATH"}
yew = {path = "/home/janis/src/yew/packages/yew"}
# UPDATE TO USE YOUR BRANCH

[profile.release]
Expand Down
30 changes: 15 additions & 15 deletions frameworks/keyed/yew/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,18 +155,18 @@ impl Component for Model {
.iter()
.map(|row| {
html! {
<Row key=row.id
data=row.clone()
selected=self.selected_id == Some(row.id)
on_select=self.on_select.clone()
on_remove=self.on_remove.clone() />
<Row key={row.id}
data={row.clone()}
selected={self.selected_id == Some(row.id)}
on_select={self.on_select.clone()}
on_remove={self.on_remove.clone()} />
}
})
.collect();

html! {
<div class="container">
<Jumbotron link=self.link.clone() />
<Jumbotron link={self.link.clone()} />
<table class="table table-hover table-striped test-data">
<tbody id="tbody">
{ rows }
Expand Down Expand Up @@ -213,22 +213,22 @@ impl Component for Jumbotron {
<div class="col-md-6">
<div class="row">
<div class="col-sm-6 smallpad">
<button type="button" id="run" class="btn btn-primary btn-block" onclick=self.link.callback(|_| Msg::Run(1_000))>{ "Create 1,000 rows" }</button>
<button type="button" id="run" class="btn btn-primary btn-block" onclick={self.link.callback(|_| Msg::Run(1_000))}>{ "Create 1,000 rows" }</button>
</div>
<div class="col-sm-6 smallpad">
<button type="button" class="btn btn-primary btn-block" onclick=self.link.callback(|_| Msg::Run(10_000)) id="runlots">{ "Create 10,000 rows" }</button>
<button type="button" class="btn btn-primary btn-block" onclick={self.link.callback(|_| Msg::Run(10_000))} id="runlots">{ "Create 10,000 rows" }</button>
</div>
<div class="col-sm-6 smallpad">
<button type="button" class="btn btn-primary btn-block" onclick=self.link.callback(|_| Msg::Add(1_000)) id="add">{ "Append 1,000 rows" }</button>
<button type="button" class="btn btn-primary btn-block" onclick={self.link.callback(|_| Msg::Add(1_000))} id="add">{ "Append 1,000 rows" }</button>
</div>
<div class="col-sm-6 smallpad">
<button type="button" class="btn btn-primary btn-block" onclick=self.link.callback(|_| Msg::Update(10)) id="update">{ "Update every 10th row" }</button>
<button type="button" class="btn btn-primary btn-block" onclick={self.link.callback(|_| Msg::Update(10))} id="update">{ "Update every 10th row" }</button>
</div>
<div class="col-sm-6 smallpad">
<button type="button" class="btn btn-primary btn-block" onclick=self.link.callback(|_| Msg::Clear) id="clear">{ "Clear" }</button>
<button type="button" class="btn btn-primary btn-block" onclick={self.link.callback(|_| Msg::Clear)} id="clear">{ "Clear" }</button>
</div>
<div class="col-sm-6 smallpad">
<button type="button" class="btn btn-primary btn-block" onclick=self.link.callback(|_| Msg::Swap) id="swaprows">{ "Swap Rows" }</button>
<button type="button" class="btn btn-primary btn-block" onclick={self.link.callback(|_| Msg::Swap)} id="swaprows">{ "Swap Rows" }</button>
</div>
</div>
</div>
Expand Down Expand Up @@ -293,13 +293,13 @@ impl Component for Row {

fn view(&self) -> Html {
html! {
<tr class=if self.props.selected { "danger" } else { "" }>
<tr class={if self.props.selected { Some("danger") } else { None }}>
<td class="col-md-1">{ self.props.data.id }</td>
<td class="col-md-4" onclick=self.state.on_select.clone()>
<td class="col-md-4" onclick={self.state.on_select.clone()}>
<a class="lbl">{ self.props.data.label.clone() }</a>
</td>
<td class="col-md-1">
<a class="remove" onclick=self.state.on_remove.clone()>
<a class="remove" onclick={self.state.on_remove.clone()}>
<span class="glyphicon glyphicon-remove remove" aria-hidden="true"></span>
</a>
</td>
Expand Down

0 comments on commit 06a0402

Please sign in to comment.