attach NewsPage to database source

This commit is contained in:
David Rodenkirchen
2024-08-28 00:24:55 +02:00
parent 093f0d6a94
commit 53c08dff28
2 changed files with 39 additions and 21 deletions
+29 -2
View File
@@ -5,6 +5,8 @@ class NewsPost(Component):
title: str = ""
text: str = ""
date: str = ""
subtitle: str = ""
author: str = ""
def build(self) -> Component:
return Rectangle(
@@ -12,7 +14,6 @@ class NewsPost(Component):
Row(
Text(
self.title,
align_x=0,
grow_x=True,
margin=2,
margin_bottom=0,
@@ -20,7 +21,7 @@ class NewsPost(Component):
fill=self.session.theme.background_color,
font_size=1.3
),
wrap=False
wrap="ellipsize"
),
Text(
self.date,
@@ -33,6 +34,18 @@ class NewsPost(Component):
wrap=True
)
),
Text(
self.subtitle,
grow_x=True,
margin=2,
margin_top=0,
margin_bottom=0,
style=TextStyle(
fill=self.session.theme.background_color,
font_size=0.8
),
wrap="ellipsize"
),
Text(
self.text,
margin=2,
@@ -40,6 +53,20 @@ class NewsPost(Component):
fill=self.session.theme.background_color
),
wrap=True
),
Text(
f"Geschrieben von {self.author}",
align_x=0,
grow_x=True,
margin=2,
margin_top=0,
margin_bottom=1,
style=TextStyle(
fill=self.session.theme.background_color,
font_size=0.5,
italic=True
),
wrap=False
)
),
fill=self.session.theme.primary_color,