from rio import Component, TextStyle, Color, Link, Button, Text


class UserInfoBoxButton(Component):
    STYLE = TextStyle(fill=Color.from_hex("02dac5"), font_size=0.6)
    label: str
    target_url: str
    open_new_tab: bool = False

    def build(self) -> Component:
        return Link(
                content=Button(
                    content=Text(self.label, style=self.STYLE),
                    shape="rectangle",
                    style="minor",
                    color="secondary",
                    grow_x=True,
                    margin_left=0.6,
                    margin_right=0.6,
                    margin_top=0.6
            ),
            target_url=self.target_url,
            open_in_new_tab=self.open_new_tab
        )
