1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
use yew::prelude::*;
#[derive(Clone, Debug, Properties, PartialEq)]
pub struct ColumnsProps {
#[prop_or_default]
pub children: Children,
#[prop_or_default]
pub classes: Classes,
/// Align child columns vertically.
#[prop_or_default]
pub vcentered: bool,
/// Allow for multiline rows.
#[prop_or_default]
pub multiline: bool,
/// Center all child columns within their row.
#[prop_or_default]
pub centered: bool,
}
/// The container for a set of responsive columns.
///
/// [https://bulma.io/documentation/columns/](https://bulma.io/documentation/columns/)
#[function_component(Columns)]
pub fn columns(props: &ColumnsProps) -> Html {
let class = classes!(
"columns",
props.classes.clone(),
props.vcentered.then_some("is-vcentered"),
props.multiline.then_some("is-multiline"),
props.centered.then_some("is-centered"),
);
html! {
<div {class}>
{props.children.clone()}
</div>
}
}
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
#[derive(Clone, Debug, Properties, PartialEq)]
pub struct ColumnProps {
#[prop_or_default]
pub children: Children,
#[prop_or_default]
pub classes: Classes,
}
/// A flexbox-based responsive column.
///
/// [https://bulma.io/documentation/columns/](https://bulma.io/documentation/columns/)
///
/// This component has a very large number of valid class combinations which users may want.
/// Modelling all of these is particularly for this component, so for now you are encouraged to
/// add classes to this Component manually via the `classes` prop.
#[function_component(Column)]
pub fn column(props: &ColumnProps) -> Html {
html! {
<div class={classes!("column", props.classes.clone())}>
{props.children.clone()}
</div>
}
}