From b874d6b3d503b9c1384108926022f2bab7d48e9f Mon Sep 17 00:00:00 2001 From: "Joseph R. Quinn" <423821+quinnjr@users.noreply.github.com> Date: Wed, 28 Oct 2020 19:49:58 -0400 Subject: [PATCH 1/2] Adding `id` fields to most components. --- CHANGELOG.md | 4 ++++ Cargo.toml | 2 +- src/columns/mod.rs | 11 ++++++++--- src/components/breadcrumb.rs | 5 ++++- src/components/card.rs | 29 ++++++++++++++++++++--------- src/components/dropdown.rs | 5 ++++- src/components/menu.rs | 17 ++++++++++++----- src/components/message.rs | 17 ++++++++++++----- src/components/modal.rs | 21 +++++++++++---------- src/components/navbar.rs | 30 ++++++++++++++++++++---------- src/components/pagination.rs | 8 ++++---- src/components/panel.rs | 10 ++++++---- src/components/tabs.rs | 5 ++++- src/elements/box.rs | 5 ++++- src/elements/button.rs | 31 ++++++++++++++++++++++--------- src/elements/content.rs | 5 ++++- src/elements/delete.rs | 5 ++++- src/elements/icon.rs | 5 ++++- src/elements/image.rs | 5 ++++- src/elements/notification.rs | 5 ++++- src/elements/progress.rs | 5 ++++- src/elements/table.rs | 7 +++++-- src/elements/tag.rs | 6 ++++-- src/elements/title.rs | 11 ++++++++--- src/form/checkbox.rs | 5 ++++- src/form/control.rs | 5 ++++- src/form/field.rs | 11 ++++++++--- src/form/file.rs | 5 ++++- src/form/input.rs | 4 ++++ src/form/radio.rs | 5 ++++- src/form/select.rs | 6 ++++-- src/form/textarea.rs | 4 ++++ src/layout/container.rs | 5 ++++- src/layout/footer.rs | 5 ++++- src/layout/hero.rs | 9 ++++++--- src/layout/level.rs | 8 ++++---- src/layout/media.rs | 8 ++++---- src/layout/section.rs | 5 ++++- src/layout/tile.rs | 5 ++++- 39 files changed, 243 insertions(+), 101 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 16a8efd..b8286e4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ This changelog follows the patterns described here: https://keepachangelog.com/e ## Unreleased +## 0.1.7 +### added +- Added field `id` to compenents missing the field. + ## 0.1.6 ### changed - Updates to the `Navbar` component: diff --git a/Cargo.toml b/Cargo.toml index 4701c76..5900727 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "ybc" -version = "0.1.6" +version = "0.1.7" description = "A Yew component library based on the Bulma CSS framework." authors = ["Anthony Dodd "] edition = "2018" diff --git a/src/columns/mod.rs b/src/columns/mod.rs index 9364425..6b99dd8 100644 --- a/src/columns/mod.rs +++ b/src/columns/mod.rs @@ -7,6 +7,8 @@ pub struct ColumnsProps { pub children: Children, #[prop_or_default] pub classes: Option, + #[prop_or_default] + pub id: String, /// Align child columns vertically. #[prop_or_default] pub vcentered: bool, @@ -55,15 +57,15 @@ impl Component for Columns { if self.props.centered { classes.push("is-centered"); } + let id = &self.props.id; html! { -
+
{self.props.children.clone()}
} } } -////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////// #[derive(Clone, Debug, Properties, PartialEq)] @@ -72,6 +74,8 @@ pub struct ColumnProps { pub children: Children, #[prop_or_default] pub classes: Option, + #[prop_or_default] + pub id: String, } /// A flexbox-based responsive column. @@ -106,8 +110,9 @@ impl Component for Column { if let Some(extra) = &self.props.classes { classes = classes.extend(extra); } + let id = &self.props.id; html! { -
+
{self.props.children.clone()}
} diff --git a/src/components/breadcrumb.rs b/src/components/breadcrumb.rs index 32d39c4..acc81d1 100644 --- a/src/components/breadcrumb.rs +++ b/src/components/breadcrumb.rs @@ -11,6 +11,8 @@ pub struct BreadcrumbProps { pub children: Children, #[prop_or_default] pub classes: Option, + #[prop_or_default] + pub id: String, /// The size of this component. #[prop_or_default] pub size: Option, @@ -59,8 +61,9 @@ impl Component for Breadcrumb { if let Some(separator) = &self.props.separator { classes.push(&separator.to_string()); } + let id = &self.props.id; html! { -