daisy_rsx 0.1.54

Daisy UI components for the Dioxus Rust library.
Documentation
use dioxus::prelude::*;

#[derive(Clone, PartialEq, Eq, Debug)]
pub struct FooterLinks {
    pub blog: String,
    pub pricing: String,
    pub contact: String,
    pub terms: String,
    pub privacy: String,
    pub about: Option<String>,
}

#[component]
pub fn Footer(margin_top: Option<String>, links: FooterLinks) -> Element {
    let extra_class = if let Some(extra_class) = margin_top {
        extra_class
    } else {
        "mt-24".to_string()
    };
    rsx! {
        footer {
            class: "{extra_class} bg-neutral text-neutral-content p-10",
            div {
                class: "mx-auto lg:max-w-5xl flex flex-col md:flex-row justify-between",
                nav {
                    h6 {
                        class: "footer-title",
                        "Resources"
                    }
                    a {
                        href: links.blog.clone(),
                        class: "block link-hover",
                        "Blog"
                    }
                    a {
                        href: links.pricing.clone(),
                        class: "block link-hover",
                        "Pricing"
                    }
                }
                nav {
                    h6 {
                        class: "footer-title",
                        "Company"
                    }
                    if let Some(about) = links.about.clone() {
                        a {
                            class: "block link-hover",
                            href: about,
                            "About Us"
                        }
                    } else {
                        a {
                            class: "block link-hover",
                            "About Us"
                        }
                    }
                    a {
                        href: links.contact.clone(),
                        class: "block link-hover",
                        "Contact"
                    }
                }
                nav {
                    h6 {
                        class: "footer-title",
                        "Legal"
                    }
                    a {
                        href: links.terms.clone(),
                        class: "block link-hover",
                        "Terms of Use"
                    }
                    a {
                        href: links.privacy.clone(),
                        class: "block link-hover",
                        "Privacy Policy"
                    }
                }
            }
        }
    }
}