feat(ui): Display header, footer, and searchbar

This commit is contained in:
bronsen 2025-12-04 13:21:49 +01:00
parent de8c467d7f
commit 65ee1e37c6
2 changed files with 71 additions and 0 deletions

View file

@ -0,0 +1,8 @@
"""
This file exists so the directory becomes a package.
"""
from .main import main
if __name__ == "__main__":
main()

View file

@ -0,0 +1,63 @@
"""
This is where the application is implemented.
"""
from typing import final, override
from textual.app import App, ComposeResult
from textual.containers import Horizontal
from textual.screen import Screen
from textual.widget import Widget
from textual.widgets import (
Button,
Footer,
Header,
Input,
)
@final
class SearchBar(Widget):
DEFAULT_CSS = """
#teilchen-input {
width: 4fr;
}
#button-search, #button-add {
width: 1fr;
}
"""
@override
def compose(self) -> ComposeResult:
with Horizontal(id="search-bar-widget"):
yield Input(
placeholder="Enter Teilchen information: name, description, #tags",
tooltip=(
"This is a free-form field: Enter a name and "
"description any way you like. You should use #hashtags for any "
"meta information."
),
id="teilchen-input",
type="text",
)
yield Button("Add", variant="success", id="button-add")
yield Button("Search", variant="default", id="button-search")
class AddInventoryScreen(Screen[None]):
@override
def compose(self) -> ComposeResult:
yield Header()
yield SearchBar()
yield Footer()
@final
class SammlerApp(App[None]):
def on_mount(self) -> None:
_ = self.push_screen(AddInventoryScreen())
def main() -> None:
app = SammlerApp()
app.run()