from __future__ import annotations

from typing import *  # type: ignore

import rio
from from_root import from_root

from .page_builder import build_page
from .. import components as comps


class Home(rio.Component):
    @rio.event.on_populate
    async def on_populate(self) -> None:
        await self.session.set_title("EZ GG e.V.")

    def build(self) -> rio.Component:
        return build_page(rio.Column(
            rio.Rectangle(
                content=rio.Markdown("### Willkommen auf der Homepage der EZ GG e.V.", margin=1),
                fill=self.session.theme.neutral_color,
                corner_radius=self.session.theme.corner_radius_medium,
                shadow_radius=0.5,
                shadow_color=self.session.theme.hud_color,
                shadow_offset_y=0,
                margin_bottom=1,
                margin_right=1
            ),
            comps.NewsPost(
                header="Startschuss für Homepage",
                article_text=from_root("ezgg_website/assets/news_27_05_24.md"),
                date="24.05.2024"
            )
        ))
