Enum patternfly_yew::Type
source · pub enum Type {
Default,
Info,
Success,
Warning,
Danger,
}Variants§
Implementations§
source§impl Type
impl Type
sourcepub fn as_classes(&self) -> Vec<&'static str> ⓘ
pub fn as_classes(&self) -> Vec<&'static str> ⓘ
Examples found in repository?
src/alert.rs (line 84)
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152
fn view(&self, ctx: &Context<Self>) -> Html {
let mut classes = Classes::from("pf-c-alert");
classes.extend(ctx.props().r#type.as_classes());
if ctx.props().inline {
classes.push("pf-m-inline");
}
if ctx.props().truncate {
classes.push("pf-m-truncate");
}
let t = ctx.props().r#type;
let actions = if ctx.props().actions.is_empty() {
html! {}
} else {
html! {
<div class="pf-c-alert__action-group">
{for ctx.props().actions.iter().map(|action|{
html!{
<Button
variant={Variant::InlineLink}
label={action.label.clone()}
onclick={action.callback.reform(|_|())}
/>
}
})}
</div>
}
};
return html! {
<div id={ctx.props().id.clone()} class={classes} aria_label={t.aria_label()}>
<div class="pf-c-alert__icon">{ t.icon() }</div>
<div class="pf-c-alert__title">
<strong>
<span class="pf-screen-reader">{ t.aria_label() }{":"}</span>
{ &ctx.props().title }
</strong>
</div>
{
if let Some(onclose) = ctx.props().onclose.as_ref() {
html!{
<div class="pf-c-alert__action">
<Button variant={Variant::Plain} icon={Icon::Times} onclick={onclose.clone().reform(|_|())} />
</div>
}
} else {
html!{}
}
}
{
if ctx.props().children.len() > 0 {
html!{
<div class="pf-c-alert__description">
{ for ctx.props().children.iter() }
</div>
}
} else {
html!{}
}
}
{ actions }
</div>
};
}sourcepub fn aria_label(&self) -> &'static str
pub fn aria_label(&self) -> &'static str
Examples found in repository?
src/alert.rs (line 115)
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152
fn view(&self, ctx: &Context<Self>) -> Html {
let mut classes = Classes::from("pf-c-alert");
classes.extend(ctx.props().r#type.as_classes());
if ctx.props().inline {
classes.push("pf-m-inline");
}
if ctx.props().truncate {
classes.push("pf-m-truncate");
}
let t = ctx.props().r#type;
let actions = if ctx.props().actions.is_empty() {
html! {}
} else {
html! {
<div class="pf-c-alert__action-group">
{for ctx.props().actions.iter().map(|action|{
html!{
<Button
variant={Variant::InlineLink}
label={action.label.clone()}
onclick={action.callback.reform(|_|())}
/>
}
})}
</div>
}
};
return html! {
<div id={ctx.props().id.clone()} class={classes} aria_label={t.aria_label()}>
<div class="pf-c-alert__icon">{ t.icon() }</div>
<div class="pf-c-alert__title">
<strong>
<span class="pf-screen-reader">{ t.aria_label() }{":"}</span>
{ &ctx.props().title }
</strong>
</div>
{
if let Some(onclose) = ctx.props().onclose.as_ref() {
html!{
<div class="pf-c-alert__action">
<Button variant={Variant::Plain} icon={Icon::Times} onclick={onclose.clone().reform(|_|())} />
</div>
}
} else {
html!{}
}
}
{
if ctx.props().children.len() > 0 {
html!{
<div class="pf-c-alert__description">
{ for ctx.props().children.iter() }
</div>
}
} else {
html!{}
}
}
{ actions }
</div>
};
}sourcepub fn icon(&self) -> Icon
pub fn icon(&self) -> Icon
Examples found in repository?
src/alert.rs (line 116)
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152
fn view(&self, ctx: &Context<Self>) -> Html {
let mut classes = Classes::from("pf-c-alert");
classes.extend(ctx.props().r#type.as_classes());
if ctx.props().inline {
classes.push("pf-m-inline");
}
if ctx.props().truncate {
classes.push("pf-m-truncate");
}
let t = ctx.props().r#type;
let actions = if ctx.props().actions.is_empty() {
html! {}
} else {
html! {
<div class="pf-c-alert__action-group">
{for ctx.props().actions.iter().map(|action|{
html!{
<Button
variant={Variant::InlineLink}
label={action.label.clone()}
onclick={action.callback.reform(|_|())}
/>
}
})}
</div>
}
};
return html! {
<div id={ctx.props().id.clone()} class={classes} aria_label={t.aria_label()}>
<div class="pf-c-alert__icon">{ t.icon() }</div>
<div class="pf-c-alert__title">
<strong>
<span class="pf-screen-reader">{ t.aria_label() }{":"}</span>
{ &ctx.props().title }
</strong>
</div>
{
if let Some(onclose) = ctx.props().onclose.as_ref() {
html!{
<div class="pf-c-alert__action">
<Button variant={Variant::Plain} icon={Icon::Times} onclick={onclose.clone().reform(|_|())} />
</div>
}
} else {
html!{}
}
}
{
if ctx.props().children.len() > 0 {
html!{
<div class="pf-c-alert__description">
{ for ctx.props().children.iter() }
</div>
}
} else {
html!{}
}
}
{ actions }
</div>
};
}Trait Implementations§
source§impl Ord for Type
impl Ord for Type
source§impl PartialOrd<Type> for Type
impl PartialOrd<Type> for Type
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self and other) and is used by the <=
operator. Read moreimpl Copy for Type
impl Eq for Type
impl StructuralEq for Type
impl StructuralPartialEq for Type
Auto Trait Implementations§
impl RefUnwindSafe for Type
impl Send for Type
impl Sync for Type
impl Unpin for Type
impl UnwindSafe for Type
Blanket Implementations§
source§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoPropValue<Option<T>> for T
impl<T> IntoPropValue<Option<T>> for T
source§fn into_prop_value(self) -> Option<T>
fn into_prop_value(self) -> Option<T>
Convert
self to a value of a Properties struct.source§impl<T> IntoPropValue<T> for T
impl<T> IntoPropValue<T> for T
source§fn into_prop_value(self) -> T
fn into_prop_value(self) -> T
Convert
self to a value of a Properties struct.