From dd3e2bde22616c4e9b88ba3b1544f522b30dc5ca Mon Sep 17 00:00:00 2001 From: Lendemor Date: Tue, 28 Jan 2025 17:48:30 +0100 Subject: [PATCH] merging two style instance should give a style instance --- reflex/style.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/reflex/style.py b/reflex/style.py index 3916bbc7c..d6bc28c5a 100644 --- a/reflex/style.py +++ b/reflex/style.py @@ -292,6 +292,19 @@ class Style(dict): ) super().__setitem__(key, value) + def __or__(self, other: Style) -> Style: + """Combine two styles. + + Args: + other: The other style to combine. + + Returns: + The combined style. + """ + if not isinstance(other, Style): + other = Style(other) + return Style(super().__or__(self, other)) + def _format_emotion_style_pseudo_selector(key: str) -> str: """Format a pseudo selector for emotion CSS-in-JS.