Skip to content

Commit

Permalink
Merge pull request isosphere#19 from dricair/main
Browse files Browse the repository at this point in the history
Added onclick handlers for Row/Column
  • Loading branch information
isosphere authored Apr 24, 2023
2 parents b576d56 + 88b88d7 commit 61777a0
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 7 deletions.
2 changes: 1 addition & 1 deletion packages/yew-bootstrap/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "yew-bootstrap"
version = "0.5.14"
version = "0.5.15"
authors = ["Matthew Scheffel <[email protected]>", "Foorack <[email protected]>"]
edition = "2021"
license = "MIT"
Expand Down
4 changes: 2 additions & 2 deletions packages/yew-bootstrap/src/component/badge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,10 @@ impl Component for Badge {
let mut classes = Classes::new();
match &props.position {
Some(position) => {
classes.push(format!("position-absolute"));
classes.push("position-absolute".to_string());
classes.push(format!("{}", position.0));
classes.push(format!("{}", position.1));
classes.push(format!("translate-middle"));
classes.push("translate-middle".to_string());
}
None => {}
}
Expand Down
9 changes: 7 additions & 2 deletions packages/yew-bootstrap/src/component/column.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ use yew::prelude::*;

/// # Column container
/// Used with [crate::component::Row] to create grids
///
///
/// See [crate::component::ColumnProps] for a listing of properties
///
///
/// ## Example
/// ```rust
/// use yew::prelude::*;
Expand Down Expand Up @@ -55,6 +55,10 @@ pub struct ColumnProps {
/// Size (out of 12) for very very large screens
#[prop_or_default]
pub xxl: Option<u8>,

/// Event called when the element is clicked
#[prop_or_default]
pub onclick: Callback<MouseEvent>,
}

impl Component for Column {
Expand Down Expand Up @@ -113,6 +117,7 @@ impl Component for Column {
html! {
<div
class={classes}
onclick={props.onclick.clone()}
>
{ for props.children.iter() }
</div>
Expand Down
9 changes: 7 additions & 2 deletions packages/yew-bootstrap/src/component/row.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ use yew::prelude::*;

/// # Row container
/// Used alongside [crate::component::Column] to create grids
///
///
/// See [crate::component::RowProps] for a listing of properties
///
///
/// ## Example
/// ```rust
/// use yew::prelude::*;
Expand All @@ -28,6 +28,10 @@ pub struct RowProps {
#[prop_or_default]
pub class: String,

/// Event called when the element is clicked
#[prop_or_default]
pub onclick: Callback<MouseEvent>,

/// Children of type [crate::component::Column]
#[prop_or_default]
pub children: ChildrenWithProps<Column>,
Expand All @@ -50,6 +54,7 @@ impl Component for Row {
html! {
<div
class={classes}
onclick={props.onclick.clone()}
>
{ for props.children.iter() }
</div>
Expand Down

0 comments on commit 61777a0

Please sign in to comment.