@use crate::templates::pages::{words_html, kanji_html, names_html, sentences_html, about_html, info_html, news_html};

@use crate::{BaseData, ResultData, Site};
@(data: &BaseData)

<!-- Main Body -->
<div id="page-container">
   <div class="d-flex center">
      <div class="main-container">
         <br>

         @match data.site.clone() {
            Site::SearchResult(search_result) => {
               @match search_result.result {
                  ResultData::Word(result) => {
                     @:words_html(&data, &search_result.query, result)
                  }
                  ResultData::KanjiInfo(result) => {
                     @:kanji_html(&data, result)
                  }
                  ResultData::Name(result) => {
                     @:names_html(&data, result)
                  }
                  ResultData::Sentence(result) => {
                     @:sentences_html(&data, result)
                  }
               }
            }
            Site::Index => {
               @*@:index_html(&data)*@
            }
            Site::About => {
               @:about_html(&data)
            }
            Site::InfoPage => {
               @:info_html(&data)
            }
            Site::News(news) => {
               @:news_html(&data, news)
            }
         }

      </div>
   </div>
</div>
