fn div_grid_header<'a>(
            root_rendering_component: &'a RootRenderingComponent,
            bump: &'a Bump,
        ) -> Node<'a> {
            use dodrio::builder::*;
            //this game_data mutable reference is dropped on the end of the function
            let game_data = &root_rendering_component.game_data;
            //if the Spellings are visible, than don't show GameTitle, because there is not
            //enought space on smartphones
            if game_data.card_index_of_first_click != 0 || game_data.card_index_of_second_click != 0
            {
                //if the two opened card match use green else use red color
                let color; //haha variable does not need to be mutable. Great !

                if game_data
                    .vec_cards
                    .get(game_data.card_index_of_first_click)
                    .expect("error index")
                    .card_number_and_img_src
                    == game_data
                        .vec_cards
                        .get(game_data.card_index_of_second_click)
                        .expect("error index")
                        .card_number_and_img_src
                {
                    color = "green";
                } else if game_data.card_index_of_first_click == 0
                    || game_data.card_index_of_second_click == 0
                {
                    color = "yellow";
                } else {
                    color = "red";
                }

                {
                    //return
                    div(bump)
                .attr("class", "grid_container_header")
                .attr(
                    "style",
                    bumpalo::format!(in bump, "grid-template-columns: auto auto; color:{}",color)
                        .into_bump_str(),
                )
                .children([
                    div(bump)
                        .attr("class", "grid_item")
                        .attr("style", "text-align: left;")
                        .children([text(
bumpalo::format!(in bump, "{}",
 root_rendering_component.game_data.spelling.clone().expect("root_rendering_component.game_data.spelling.clone()")
 .name.get(game_data.vec_cards.get(game_data.card_index_of_first_click).expect("error index")
                                .card_number_and_img_src).expect("error index")
)
                        .into_bump_str(),
                        )])
                        .finish(),
                    div(bump)
                        .attr("class", "grid_item")
                        .attr("style", "text-align: right;")
                        .children([text(
                            bumpalo::format!(in bump, "{}",
                            root_rendering_component.game_data.spelling.clone().expect("root_rendering_component.game_data.spelling.clone()")
                            .name.get(game_data.vec_cards.get(game_data.card_index_of_second_click)
                            .expect("error index")
                                .card_number_and_img_src).expect("error index")
                                )
                        .into_bump_str(),
                        )])
                        .finish(),
                ])
                .finish()
                }
            } else {
                {
                    div(bump)
                        .attr("class", "grid_container_header")
                        .attr("style", "grid-template-columns: auto;")
                        .children([div(bump)
                            .attr("class", "grid_item")
                            .attr("style", "text-align: center;")
                            .children([text(GAME_TITLE)])
                            .finish()])
                        .finish()
                }
            }
        }
///the header can show only the game title or two spellings. Not everything together.
the header can show only the game title or two spellings. Not everything together.
the header can show only the game title or two spellings . Not everything together .
fn div_grid_header<'a>(
            root_rendering_component: &'a RootRenderingComponent,
            bump: &'a Bump,
        ) -> Node<'a> {
            use dodrio::builder::*;
            //this game_data mutable reference is dropped on the end of the function
            let game_data = &root_rendering_component.game_data;
            //if the Spellings are visible, than don't show GameTitle, because there is not
            //enought space on smartphones
            if game_data.card_index_of_first_click != 0 || game_data.card_index_of_second_click != 0
            {
                //if the two opened card match use green else use red color
                let color; //haha variable does not need to be mutable. Great !
                if game_data
                    .vec_cards
                    .get(game_data.card_index_of_first_click)
                    .expect("error index")
                    .card_number_and_img_src
                    == game_data
                        .vec_cards
                        .get(game_data.card_index_of_second_click)
                        .expect("error index")
                        .card_number_and_img_src
                {
                    color = "green";
                } else if game_data.card_index_of_first_click == 0
                    || game_data.card_index_of_second_click == 0
                {
                    color = "yellow";
                } else {
                    color = "red";
                }
                {
                    //return
                    div(bump)
                .attr("class", "grid_container_header")
                .attr(
                    "style",
                    bumpalo::format!(in bump, "grid-template-columns: auto auto; color:{}",color)
                        .into_bump_str(),
                )
                .children([
                    div(bump)
                        .attr("class", "grid_item")
                        .attr("style", "text-align: left;")
                        .children([text(
bumpalo::format!(in bump, "{}",
 root_rendering_component.game_data.spelling.clone().expect("root_rendering_component.game_data.spelling.clone()")
 .name.get(game_data.vec_cards.get(game_data.card_index_of_first_click).expect("error index")
                                .card_number_and_img_src).expect("error index")
)
                        .into_bump_str(),
                        )])
                        .finish(),
                    div(bump)
                        .attr("class", "grid_item")
                        .attr("style", "text-align: right;")
                        .children([text(
                            bumpalo::format!(in bump, "{}",
                            root_rendering_component.game_data.spelling.clone().expect("root_rendering_component.game_data.spelling.clone()")
                            .name.get(game_data.vec_cards.get(game_data.card_index_of_second_click)
                            .expect("error index")
                                .card_number_and_img_src).expect("error index")
                                )
                        .into_bump_str(),
                        )])
                        .finish(),
                ])
                .finish()
                }
            } else {
                {
                    div(bump)
                        .attr("class", "grid_container_header")
                        .attr("style", "grid-template-columns: auto;")
                        .children([div(bump)
                            .attr("class", "grid_item")
                            .attr("style", "text-align: center;")
                            .children([text(GAME_TITLE)])
                            .finish()])
                        .finish()
                }
            }
        }
fn div_grid_header < ' a > ( root_rendering_component : & ' a RootRenderingComponent , bump : & ' a Bump , ) -> Node < ' a > { use dodrio :: builder :: * ; //this game_data mutable reference is dropped on the end of the function let game_data = & root_rendering_component . game_data ; //if the Spellings are visible, than don't show GameTitle, because there is not //enought space on smartphones if game_data . card_index_of_first_click != 0 || game_data . card_index_of_second_click != 0 { //if the two opened card match use green else use red color let color ; //haha variable does not need to be mutable. Great ! if game_data . vec_cards . get ( game_data . card_index_of_first_click ) . expect ( " " ) . card_number_and_img_src == game_data . vec_cards . get ( game_data . card_index_of_second_click ) . expect ( " " ) . card_number_and_img_src { color = " " ; } else if game_data . card_index_of_first_click == 0 || game_data . card_index_of_second_click == 0 { color = " " ; } else { color = " " ; } { //return div ( bump ) . attr ( " " , " " ) . attr ( " " , bumpalo :: format ! ( in bump " " color ) . into_bump_str ( ) , ) . children ( [ div ( bump ) . attr ( " " , " " ) . attr ( " " , " " ) . children ( [ text ( bumpalo :: format ! ( in bump " " root_rendering_component game_data spelling clone ( ) expect ( " " ) name get ( game_data vec_cards get ( game_data card_index_of_first_click ) expect ( " " ) card_number_and_img_src ) expect ( " " ) ) . into_bump_str ( ) , ) ] ) . finish ( ) , div ( bump ) . attr ( " " , " " ) . attr ( " " , " " ) . children ( [ text ( bumpalo :: format ! ( in bump " " root_rendering_component game_data spelling clone ( ) expect ( " " ) name get ( game_data vec_cards get ( game_data card_index_of_second_click ) expect ( " " ) card_number_and_img_src ) expect ( " " ) ) . into_bump_str ( ) , ) ] ) . finish ( ) , ] ) . finish ( ) } } else { { div ( bump ) . attr ( " " , " " ) . attr ( " " , " " ) . children ( [ div ( bump ) . attr ( " " , " " ) . attr ( " " , " " ) . children ( [ text ( GAME_TITLE ) ] ) . finish ( ) ] ) . finish ( ) } } }
the header can show only the game title or two spellings.
the header can show only the game title or two spellings .
root_rendering_component
&'a RootRenderingComponent
bump
&'a Bump
root_rendering_component
&'a RootRenderingComponent
bump
&'a Bump