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

This commit is contained in:
Elijah Ahianyo 2024-02-16 17:41:02 +00:00 committed by GitHub
parent 10984ef869
commit 3f24b42260
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 9 additions and 25 deletions

View File

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

View File

@ -62,11 +62,15 @@ class Tag(Base):
Returns: Returns:
The tag with the props added. The tag with the props added.
""" """
from reflex.components.core.colors import Color
self.props.update( self.props.update(
{ {
format.to_camel_case(name, allow_hyphens=True): prop format.to_camel_case(name, allow_hyphens=True): prop
if types._isinstance(prop, Union[EventChain, dict]) 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() for name, prop in kwargs.items()
if self.is_valid_prop(prop) if self.is_valid_prop(prop)
} }