Repository: Appsilon/py_shiny_semantic (language: python)

Issue:
[Elements] Segment



Discussion / hints:

Fix patch:
diff --git a/shiny_semantic/elements/__init__.py b/shiny_semantic/elements/__init__.py
index 36ea6c7..dc3fc36 100644
--- a/shiny_semantic/elements/__init__.py
+++ b/shiny_semantic/elements/__init__.py
@@ -1,9 +1,15 @@
 # Semantic `Elements` section, e.g. Button, Flag, Icon, etc
 __all__ = (
     "button",
-    "update_button",
+    "container",
+    "divider",
     "emoji",
+    "segment",
+    "update_button",
 )
 
 from .button import button, update_button
+from .container import container
+from .divider import divider
 from .emoji import emoji
+from .segment import segment
diff --git a/shiny_semantic/elements/container.py b/shiny_semantic/elements/container.py
new file mode 100644
index 0000000..0c5eb80
--- /dev/null
+++ b/shiny_semantic/elements/container.py
@@ -0,0 +1,7 @@
+from typing import Optional
+
+from shiny.ui import tags
+
+
+def container(*args, class_name: Optional[str] = ""):
+    return tags.div(*args, class_=f"ui {class_name} container")
diff --git a/shiny_semantic/elements/divider.py b/shiny_semantic/elements/divider.py
new file mode 100644
index 0000000..4c38181
--- /dev/null
+++ b/shiny_semantic/elements/divider.py
@@ -0,0 +1,7 @@
+from typing import Optional
+
+from shiny.ui import tags
+
+
+def divider(*args, class_name: Optional[str] = ""):
+    return tags.div(*args, class_=f"ui {class_name} divider")
diff --git a/shiny_semantic/elements/segment.py b/shiny_semantic/elements/segment.py
new file mode 100644
index 0000000..dce0b99
--- /dev/null
+++ b/shiny_semantic/elements/segment.py
@@ -0,0 +1,7 @@
+from typing import Optional
+
+from shiny.ui import tags
+
+
+def segment(*args, class_name: Optional[str] = ""):
+    return tags.div(*args, class_=f"ui {class_name} segment")


Test patch:
diff --git a/tests/test_container.py b/tests/test_container.py
new file mode 100644
index 0000000..db58814
--- /dev/null
+++ b/tests/test_container.py
@@ -0,0 +1,24 @@
+import unittest
+
+from shiny import App
+
+from shiny_semantic import page_semantic
+from shiny_semantic.elements import container
+
+
+class TestContainer(unittest.TestCase):
+    def test_container(self):
+        expected_html = '<div class="ui  container">'
+
+        app = App(
+            page_semantic(container("Hello")),
+            None,
+        )
+
+        html = app.ui.get("html")
+
+        self.assertTrue(expected_html in html)
+
+
+if __name__ == "__main__":
+    unittest.main()
diff --git a/tests/test_divider.py b/tests/test_divider.py
new file mode 100644
index 0000000..5cc5b8a
--- /dev/null
+++ b/tests/test_divider.py
@@ -0,0 +1,24 @@
+import unittest
+
+from shiny import App
+
+from shiny_semantic import page_semantic
+from shiny_semantic.elements import divider
+
+
+class TestDivider(unittest.TestCase):
+    def test_divider(self):
+        expected_html = '<div class="ui  divider">'
+
+        app = App(
+            page_semantic(divider("Hello")),
+            None,
+        )
+
+        html = app.ui.get("html")
+
+        self.assertTrue(expected_html in html)
+
+
+if __name__ == "__main__":
+    unittest.main()
diff --git a/tests/test_segment.py b/tests/test_segment.py
new file mode 100644
index 0000000..f2905ac
--- /dev/null
+++ b/tests/test_segment.py
@@ -0,0 +1,24 @@
+import unittest
+
+from shiny import App
+
+from shiny_semantic import page_semantic
+from shiny_semantic.elements import segment
+
+
+class TestSegment(unittest.TestCase):
+    def test_segment(self):
+        expected_html = '<div class="ui  segment">'
+
+        app = App(
+            page_semantic(segment("Hello")),
+            None,
+        )
+
+        html = app.ui.get("html")
+
+        self.assertTrue(expected_html in html)
+
+
+if __name__ == "__main__":
+    unittest.main()