37 lines
1.2 KiB
Python
37 lines
1.2 KiB
Python
from pathlib import Path
|
|
from dataclasses import dataclass
|
|
|
|
import rio
|
|
|
|
@dataclass
|
|
class MemberInfo:
|
|
picture_path: Path
|
|
name: str
|
|
position: str
|
|
entry_date: str
|
|
|
|
|
|
class MemberCard(rio.Component):
|
|
def __init__(self, info: MemberInfo) -> None:
|
|
super().__init__()
|
|
self._info = info
|
|
self.align_y = 0
|
|
self.margin_top = 0
|
|
self.margin_bottom = 2
|
|
self.margin_right = 1
|
|
|
|
def build(self) -> rio.Component:
|
|
return rio.Rectangle(
|
|
content=rio.Column(
|
|
rio.Image(self._info.picture_path, height=9, margin_bottom=1.3),
|
|
rio.Text(self._info.name, margin_bottom=0.4, style=rio.TextStyle(font_weight="bold")),
|
|
rio.Text(self._info.position, margin_bottom=0.4, style=rio.TextStyle(italic=True)),
|
|
rio.Text(f"Mitglied seit {self._info.entry_date}", style=rio.TextStyle(italic=True), margin_bottom=0.4)
|
|
),
|
|
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
|
|
)
|