Enum patternfly_yew::Type

source ·
pub enum Type {
    Default,
    Info,
    Success,
    Warning,
    Danger,
}

Variants§

§

Default

§

Info

§

Success

§

Warning

§

Danger

Implementations§

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>
        };
    }
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>
        };
    }
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§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Returns the “default value” for a type. Read more
This method returns an Ordering between self and other. Read more
Compares and returns the maximum of two values. Read more
Compares and returns the minimum of two values. Read more
Restrict a value to a certain interval. Read more
This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more
This method returns an ordering between self and other values if one exists. Read more
This method tests less than (for self and other) and is used by the < operator. Read more
This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
This method tests greater than (for self and other) and is used by the > operator. Read more
This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
Compare self to key and return true if they are equal.

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Convert self to a value of a Properties struct.
Convert self to a value of a Properties struct.
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more