Browse Source

Drawer component styles should only be in css dict (#2640)

Elijah Ahianyo 1 year ago
parent
commit
3f24b42260
2 changed files with 9 additions and 25 deletions
  1. 4 24
      reflex/components/radix/primitives/drawer.py
  2. 5 1
      reflex/components/tags/tag.py

+ 4 - 24
reflex/components/radix/primitives/drawer.py

@@ -119,12 +119,7 @@ class DrawerContent(DrawerComponent):
         }
         style = self.style or {}
         base_style.update(style)
-        self.style.update(
-            {
-                "css": base_style,
-            }
-        )
-        return self.style
+        return {"css": base_style}
 
     def get_event_triggers(self) -> Dict[str, Any]:
         """Get the events triggers signatures for the component.
@@ -188,12 +183,7 @@ class DrawerOverlay(DrawerComponent):
         }
         style = self.style or {}
         base_style.update(style)
-        self.style.update(
-            {
-                "css": base_style,
-            }
-        )
-        return self.style
+        return {"css": base_style}
 
 
 class DrawerClose(DrawerComponent):
@@ -226,12 +216,7 @@ class DrawerTitle(DrawerComponent):
         }
         style = self.style or {}
         base_style.update(style)
-        self.style.update(
-            {
-                "css": base_style,
-            }
-        )
-        return self.style
+        return {"css": base_style}
 
 
 class DrawerDescription(DrawerComponent):
@@ -253,12 +238,7 @@ class DrawerDescription(DrawerComponent):
         }
         style = self.style or {}
         base_style.update(style)
-        self.style.update(
-            {
-                "css": base_style,
-            }
-        )
-        return self.style
+        return {"css": base_style}
 
 
 class Drawer(ComponentNamespace):

+ 5 - 1
reflex/components/tags/tag.py

@@ -62,11 +62,15 @@ class Tag(Base):
         Returns:
             The tag with the props added.
         """
+        from reflex.components.core.colors import Color
+
         self.props.update(
             {
                 format.to_camel_case(name, allow_hyphens=True): prop
                 if types._isinstance(prop, Union[EventChain, dict])
-                else Var.create(prop)
+                else Var.create(
+                    prop, _var_is_string=isinstance(prop, Color)
+                )  # rx.color is always a string
                 for name, prop in kwargs.items()
                 if self.is_valid_prop(prop)
             }