Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migration to yew 0.18.0 #20

Merged
merged 4 commits into from
Jul 26, 2021
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# directory ignores
dist
target
.idea

# file ignores
Cargo.lock
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ This changelog follows the patterns described here: https://keepachangelog.com/e

## Unreleased

## 0.2.0
- Added support for yew `0.18.x`

## 0.1.6
### changed
- Updates to the `Navbar` component:
Expand Down
8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ybc"
version = "0.1.6"
version = "0.1.7"
thedodd marked this conversation as resolved.
Show resolved Hide resolved
description = "A Yew component library based on the Bulma CSS framework."
authors = ["Anthony Dodd <[email protected]>"]
edition = "2018"
Expand All @@ -13,9 +13,9 @@ keywords = ["wasm", "web", "bulma", "sass", "yew"]
[dependencies]
derive_more = "0.99.9"
web-sys = { version="0.3", features=["Element", "File", "HtmlCollection", "HtmlSelectElement"] }
yew = { version="0.17.3", features=["web_sys"] }
yewtil = { version="0.3.2", features=["neq"] }
yew-router = { version="0.14.0", features=["web_sys"], optional=true }
yew = { version="0.18.0", features=["web_sys"] }
yewtil = { version="0.4.0", features=["neq"] }
yew-router = { version="0.15.0", features=["web_sys"], optional=true }

[features]
default = ["router"]
Expand Down
4 changes: 2 additions & 2 deletions src/columns/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ impl Component for Columns {
fn view(&self) -> Html {
let mut classes = Classes::from("columns");
if let Some(extra) = &self.props.classes {
classes = classes.extend(extra);
classes.push(extra);
}
if self.props.vcentered {
classes.push("is-vcentered");
Expand Down Expand Up @@ -104,7 +104,7 @@ impl Component for Column {
fn view(&self) -> Html {
let mut classes = Classes::from("column");
if let Some(extra) = &self.props.classes {
classes = classes.extend(extra);
classes.push(extra);
}
html! {
<div class=classes>
Expand Down
8 changes: 8 additions & 0 deletions src/common.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
use derive_more::Display;
use std::borrow::Cow;
use yew::html::IntoOptPropValue;

/// Common alignment classes.
#[derive(Clone, Debug, Display, PartialEq)]
Expand All @@ -25,3 +27,9 @@ pub enum Size {
#[display(fmt = "large")]
Large,
}

impl IntoOptPropValue<Cow<'static, str>> for Size {
fn into_opt_prop_value(self) -> Option<Cow<'static, str>> {
Some(Cow::from(self.to_string()))
}
}
2 changes: 1 addition & 1 deletion src/components/breadcrumb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ impl Component for Breadcrumb {
fn view(&self) -> Html {
let mut classes = Classes::from("breadcrumb");
if let Some(extra) = &self.props.classes {
classes = classes.extend(extra);
classes.push(extra);
}
if let Some(size) = &self.props.size {
classes.push(&size.to_string());
Expand Down
10 changes: 5 additions & 5 deletions src/components/card.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ impl Component for Card {
fn view(&self) -> Html {
let mut classes = Classes::from("card");
if let Some(extra) = &self.props.classes {
classes = classes.extend(extra);
classes.push(extra);
}
html! {
<div class=classes>
Expand Down Expand Up @@ -82,7 +82,7 @@ impl Component for CardHeader {
fn view(&self) -> Html {
let mut classes = Classes::from("card-header");
if let Some(extra) = &self.props.classes {
classes = classes.extend(extra);
classes.push(extra);
}
html! {
<header class=classes>
Expand Down Expand Up @@ -129,7 +129,7 @@ impl Component for CardImage {
fn view(&self) -> Html {
let mut classes = Classes::from("card-image");
if let Some(extra) = &self.props.classes {
classes = classes.extend(extra);
classes.push(extra);
}
html! {
<div class=classes>
Expand Down Expand Up @@ -176,7 +176,7 @@ impl Component for CardContent {
fn view(&self) -> Html {
let mut classes = Classes::from("card-content");
if let Some(extra) = &self.props.classes {
classes = classes.extend(extra);
classes.push(extra);
}
html! {
<div class=classes>
Expand Down Expand Up @@ -223,7 +223,7 @@ impl Component for CardFooter {
fn view(&self) -> Html {
let mut classes = Classes::from("card-footer");
if let Some(extra) = &self.props.classes {
classes = classes.extend(extra);
classes.push(extra);
}
html! {
<footer class=classes>
Expand Down
2 changes: 1 addition & 1 deletion src/components/dropdown.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ impl Component for Dropdown {
fn view(&self) -> Html {
let mut classes = Classes::from("dropdown");
if let Some(extra) = &self.props.classes {
classes = classes.extend(extra);
classes.push(extra);
}
let opencb = if self.props.hoverable {
classes.push("is-hoverable");
Expand Down
6 changes: 3 additions & 3 deletions src/components/menu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ impl Component for Menu {
fn view(&self) -> Html {
let mut classes = Classes::from("menu");
if let Some(extra) = &self.props.classes {
classes = classes.extend(extra);
classes.push(extra);
}
html! {
<aside class=classes>
Expand Down Expand Up @@ -83,7 +83,7 @@ impl Component for MenuList {
fn view(&self) -> Html {
let mut classes = Classes::from("menu-list");
if let Some(extra) = &self.props.classes {
classes = classes.extend(extra);
classes.push(extra);
}
html! {
<ul class=classes>
Expand Down Expand Up @@ -131,7 +131,7 @@ impl Component for MenuLabel {
fn view(&self) -> Html {
let mut classes = Classes::from("menu-label");
if let Some(extra) = &self.props.classes {
classes = classes.extend(extra);
classes.push(extra);
}
html! {
<p class=classes>
Expand Down
6 changes: 3 additions & 3 deletions src/components/message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ impl Component for Message {
fn view(&self) -> Html {
let mut classes = Classes::from("message");
if let Some(extra) = &self.props.classes {
classes = classes.extend(extra);
classes.push(extra);
}
html! {
<article class=classes>
Expand Down Expand Up @@ -82,7 +82,7 @@ impl Component for MessageHeader {
fn view(&self) -> Html {
let mut classes = Classes::from("message-header");
if let Some(extra) = &self.props.classes {
classes = classes.extend(extra);
classes.push(extra);
}
html! {
<div class=classes>
Expand Down Expand Up @@ -129,7 +129,7 @@ impl Component for MessageBody {
fn view(&self) -> Html {
let mut classes = Classes::from("message-body");
if let Some(extra) = &self.props.classes {
classes = classes.extend(extra);
classes.push(extra);
}
html! {
<div class=classes>
Expand Down
4 changes: 2 additions & 2 deletions src/components/modal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ impl Component for Modal {
fn view(&self) -> Html {
let mut classes = Classes::from("modal");
if let Some(extra) = &self.props.classes {
classes = classes.extend(extra);
classes.push(extra);
}
let (opencb, closecb) = if self.is_active {
classes.push("is-active");
Expand Down Expand Up @@ -181,7 +181,7 @@ impl Component for ModalCard {
fn view(&self) -> Html {
let mut classes = Classes::from("modal");
if let Some(extra) = &self.props.classes {
classes = classes.extend(extra);
classes.push(extra);
}
let (opencb, closecb) = if self.is_active {
classes.push("is-active");
Expand Down
8 changes: 4 additions & 4 deletions src/components/navbar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ impl Component for Navbar {
// navbar classes
let mut classes = Classes::from("navbar");
if let Some(extra) = &self.props.classes {
classes = classes.extend(extra);
classes.push(extra);
}
if let Some(fixed) = &self.props.fixed {
classes.push(&fixed.to_string());
Expand Down Expand Up @@ -249,7 +249,7 @@ impl Component for NavbarItem {
// navbar classes
let mut classes = Classes::from("navbar-item");
if let Some(extra) = &self.props.classes {
classes = classes.extend(extra);
classes.push(extra);
}
if self.props.has_dropdown {
classes.push("has-dropdown");
Expand Down Expand Up @@ -322,7 +322,7 @@ impl Component for NavbarDivider {
fn view(&self) -> Html {
let mut classes = Classes::from("navbar-divider");
if let Some(extra) = &self.props.classes {
classes = classes.extend(extra);
classes.push(extra);
}
html! {
<hr class=classes/>
Expand Down Expand Up @@ -402,7 +402,7 @@ impl Component for NavbarDropdown {
// navbar-item classes
let mut classes = Classes::from("navbar-item has-dropdown");
if let Some(extra) = &self.props.classes {
classes = classes.extend(extra);
classes.push(extra);
}
if self.props.dropup {
classes.push("has-dropdown-up");
Expand Down
2 changes: 1 addition & 1 deletion src/components/pagination.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ impl Component for Pagination {
fn view(&self) -> Html {
let mut classes = Classes::from("pagination");
if let Some(extra) = &self.props.classes {
classes = classes.extend(extra);
classes.push(extra);
}
if let Some(size) = &self.props.size {
classes.push(&size.to_string());
Expand Down
2 changes: 1 addition & 1 deletion src/components/panel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ impl Component for Panel {
fn view(&self) -> Html {
let mut classes = Classes::from("panel");
if let Some(extra) = &self.props.classes {
classes = classes.extend(extra);
classes.push(extra);
}
html! {
<nav class=classes>
Expand Down
2 changes: 1 addition & 1 deletion src/components/tabs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ impl Component for Tabs {
fn view(&self) -> Html {
let mut classes = Classes::from("tabs");
if let Some(extra) = &self.props.classes {
classes = classes.extend(extra);
classes.push(extra);
}
if let Some(alignment) = &self.props.alignment {
classes.push(&alignment.to_string());
Expand Down
2 changes: 1 addition & 1 deletion src/elements/box.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ impl Component for Box {
fn view(&self) -> Html {
let mut classes = Classes::from("box");
if let Some(extra) = &self.props.classes {
classes = classes.extend(extra);
classes.push(extra);
}
html! {
<div class=classes>
Expand Down
10 changes: 5 additions & 5 deletions src/elements/button.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ impl Component for Buttons {
fn view(&self) -> Html {
let mut classes = Classes::from("buttons");
if let Some(extra) = &self.props.classes {
classes = classes.extend(extra);
classes.push(extra);
}
if let Some(size) = &self.props.size {
classes.push(&size.to_string());
Expand Down Expand Up @@ -116,7 +116,7 @@ impl Component for Button {
fn view(&self) -> Html {
let mut classes = Classes::from("button");
if let Some(extra) = &self.props.classes {
classes = classes.extend(extra);
classes.push(extra);
}
if self.props.loading {
classes.push("is-loading")
Expand Down Expand Up @@ -314,7 +314,7 @@ impl Component for ButtonAnchor {
fn view(&self) -> Html {
let mut classes = Classes::from("button");
if let Some(extra) = &self.props.classes {
classes = classes.extend(extra);
classes.push(extra);
}
if self.props.loading {
classes.push("is-loading")
Expand Down Expand Up @@ -384,7 +384,7 @@ impl Component for ButtonInputSubmit {
fn view(&self) -> Html {
let mut classes = Classes::from("button");
if let Some(extra) = &self.props.classes {
classes = classes.extend(extra);
classes.push(extra);
}
if self.props.loading {
classes.push("is-loading")
Expand Down Expand Up @@ -445,7 +445,7 @@ impl Component for ButtonInputReset {
fn view(&self) -> Html {
let mut classes = Classes::from("button");
if let Some(extra) = &self.props.classes {
classes = classes.extend(extra);
classes.push(extra);
}
if self.props.loading {
classes.push("is-loading")
Expand Down
2 changes: 1 addition & 1 deletion src/elements/content.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ impl Component for Content {
fn view(&self) -> Html {
let mut classes = Classes::from("content");
if let Some(extra) = &self.props.classes {
classes = classes.extend(extra);
classes.push(extra);
}
let tag = self.props.tag.clone();
html! {
Expand Down
2 changes: 1 addition & 1 deletion src/elements/delete.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ impl Component for Delete {
fn view(&self) -> Html {
let mut classes = Classes::from("delete");
if let Some(extra) = &self.props.classes {
classes = classes.extend(extra);
classes.push(extra);
}
let tag = self.props.tag.clone();
html! {
Expand Down
2 changes: 1 addition & 1 deletion src/elements/icon.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ impl Component for Icon {
fn view(&self) -> Html {
let mut classes = Classes::from("icon");
if let Some(extra) = &self.props.classes {
classes = classes.extend(extra);
classes.push(extra);
}
if let Some(size) = &self.props.size {
classes.push(&size.to_string());
Expand Down
2 changes: 1 addition & 1 deletion src/elements/image.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ impl Component for Image {
fn view(&self) -> Html {
let mut classes = Classes::from("image");
if let Some(extra) = &self.props.classes {
classes = classes.extend(extra);
classes.push(extra);
}
if let Some(size) = &self.props.size {
classes.push(&size.to_string());
Expand Down
2 changes: 1 addition & 1 deletion src/elements/notification.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ impl Component for Notification {
fn view(&self) -> Html {
let mut classes = Classes::from("notification");
if let Some(extra) = &self.props.classes {
classes = classes.extend(extra);
classes.push(extra);
}
html! {
<div class=classes>
Expand Down
2 changes: 1 addition & 1 deletion src/elements/progress.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ impl Component for Progress {
fn view(&self) -> Html {
let mut classes = Classes::from("progress");
if let Some(extra) = &self.props.classes {
classes = classes.extend(extra);
classes.push(extra);
}
let max = self.props.max.to_string();
let value = self.props.value.to_string();
Expand Down
2 changes: 1 addition & 1 deletion src/elements/table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ impl Component for Table {
fn view(&self) -> Html {
let mut classes = Classes::from("table");
if let Some(extra) = &self.props.classes {
classes = classes.extend(extra);
classes.push(extra);
}
if self.props.bordered {
classes.push("is-bordered");
Expand Down
Loading