Coverage for src / lexigram / ui / molecules / empty_state.py: 100%
12 statements
« prev ^ index » next coverage.py v7.13.5, created at 2026-08-10 04:11 +0800
« prev ^ index » next coverage.py v7.13.5, created at 2026-08-10 04:11 +0800
1from __future__ import annotations
3from typing import Any
5from lexigram.ui.core.base import Component, el
8class EmptyState(Component):
9 """Empty state component for when no data is available.
11 Args:
12 title: Main heading
13 message: Descriptive message
14 icon: Optional emoji or icon
15 action: Optional action button/link
16 """
18 def __init__(
19 self,
20 title: str = "No data available",
21 message: str = "There's nothing to display yet.",
22 icon: str = "📭",
23 action: Any = None,
24 **props,
25 ) -> None:
26 super().__init__(
27 title=title,
28 message=message,
29 icon=icon,
30 action=action,
31 **props,
32 )
33 self.title = title
34 self.message = message
35 self.icon = icon
36 self.action = action
38 def render(self) -> Any:
39 return el(
40 "div",
41 el(
42 "div",
43 el("div", self.icon, class_="text-6xl mb-4 opacity-50"),
44 el(
45 "h3",
46 self.title,
47 class_="text-lg font-semibold text-foreground mb-2",
48 ),
49 el(
50 "p",
51 self.message,
52 class_="text-sm text-muted-foreground mb-4",
53 ),
54 self.action if self.action else "",
55 class_="flex flex-col items-center justify-center text-center",
56 ),
57 class_="py-16 px-4",
58 )