from from_root import from_root
from rio import Component, Link, Rectangle, Image, Color


class NavigationSponsorBox(Component):
    img_name: str
    url: str
    img_suffix: str = "png"

    def build(self) -> Component:
        return Link(
            content=Rectangle(
                content=Image(image=from_root(f"src/ezgg_lan_manager/assets/img/{self.img_name}.{self.img_suffix}"), min_width=10, min_height=10),
                stroke_width=0.1,
                stroke_color=Color.TRANSPARENT,
                hover_stroke_width=0.1,
                hover_stroke_color=self.session.theme.secondary_color,
                margin=0.6,
                cursor="pointer"
            ),
            target_url=self.url,
            open_in_new_tab=True
        )
