use dioxus::prelude::*;

use crate::page::Page;



#[component]
pub fn TagItem(tag: String, style: Option<String>) -> Element
{
   let tag_style: String = match style
   {
      None => { String::new() }
      Some(s) => { s }
   };

   rsx!
   {
      li
      {
         key: "{tag}",
         class: "tag_item",

         Link
         {
            class: "{tag_style} tag_{tag}",

            to: Page::Blog { tag: tag.clone() },

            "{tag}"
         }
      }
   }
}

#[component]
pub fn TagList(children: Element) -> Element
{
   rsx!
   {
      ul
      {
         class: "blog_tag tag_list",
         {children}
      }
   }
}
