seed-rs / seed-rs-realworld

Exemplary real world application built with Seed
https://seed-rs.org/
MIT License
123 stars 15 forks source link

drop-down list box on header #7

Open qgx opened 4 years ago

qgx commented 4 years ago

I want to add a language drop-down list box to the header part of each page. I think this part should be achieved by modifying the page/page.rs file, but I don’t know how to send events. any ideas?

div![select![ attrs! {At::Name => "lang"}, langs.iter().map(|lang| option![attrs! {At::Value => lang}, lang]), input_ev(Ev::Change, |new_value| Msg::LangChanged(new_value)), ],],

MartinKavik commented 4 years ago

I don’t know how to send events.

What's the problem in your code?

Also you can draw inspiration from the hamburger + menu (aka dropdown) explained in the official tutorial https://seed-rs.org/0.7.0/time_tracker_header_and_routing.

Don't hesitate to write to our #support channel on the Seed chat.


Note: The realworld example hasn't been updated for a long time, I wouldn't recommend to learn from it now.