Radix Themes style notation fix (#2025)
This commit is contained in:
parent
b8f0674556
commit
d785bd98da
@ -461,6 +461,14 @@ class Component(Base, ABC):
|
|||||||
child.add_style(style)
|
child.add_style(style)
|
||||||
return self
|
return self
|
||||||
|
|
||||||
|
def _get_style(self) -> dict:
|
||||||
|
"""Get the style for the component.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
The dictionary of the component style as value and the style notation as key.
|
||||||
|
"""
|
||||||
|
return {"sx": self.style}
|
||||||
|
|
||||||
def render(self) -> Dict:
|
def render(self) -> Dict:
|
||||||
"""Render the component.
|
"""Render the component.
|
||||||
|
|
||||||
@ -472,9 +480,9 @@ class Component(Base, ABC):
|
|||||||
tag.add_props(
|
tag.add_props(
|
||||||
**self.event_triggers,
|
**self.event_triggers,
|
||||||
key=self.key,
|
key=self.key,
|
||||||
sx=self.style,
|
|
||||||
id=self.id,
|
id=self.id,
|
||||||
class_name=self.class_name,
|
class_name=self.class_name,
|
||||||
|
**self._get_style(),
|
||||||
**self.custom_attrs,
|
**self.custom_attrs,
|
||||||
).set(
|
).set(
|
||||||
children=[child.render() for child in self.children],
|
children=[child.render() for child in self.children],
|
||||||
|
@ -65,6 +65,9 @@ class RadixThemesComponent(Component):
|
|||||||
(45, "RadixThemesColorModeProvider"): RadixThemesColorModeProvider.create(),
|
(45, "RadixThemesColorModeProvider"): RadixThemesColorModeProvider.create(),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def _get_style(self) -> dict:
|
||||||
|
return {"style": self.style}
|
||||||
|
|
||||||
|
|
||||||
class Theme(RadixThemesComponent):
|
class Theme(RadixThemesComponent):
|
||||||
"""A theme provider for radix components.
|
"""A theme provider for radix components.
|
||||||
|
Loading…
Reference in New Issue
Block a user