From 6b8a6f353b6250dd3a0b84249d66f5228bdb1a99 Mon Sep 17 00:00:00 2001 From: Masen Furer Date: Tue, 7 May 2024 19:31:01 -0700 Subject: [PATCH] icon_button: Icon size should be specified as int pixels, not str (#3247) --- reflex/components/radix/themes/components/icon_button.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/reflex/components/radix/themes/components/icon_button.py b/reflex/components/radix/themes/components/icon_button.py index cd21501dbd..452e376401 100644 --- a/reflex/components/radix/themes/components/icon_button.py +++ b/reflex/components/radix/themes/components/icon_button.py @@ -70,16 +70,19 @@ def create(cls, *children, **props) -> Component: "IconButton requires a child icon. Pass a string as the first child or a rx.icon." ) if "size" in props: - RADIX_TO_LUCIDE_SIZE = {"1": "12px", "2": "24px", "3": "36px", "4": "48px"} + RADIX_TO_LUCIDE_SIZE = {"1": 12, "2": 24, "3": 36, "4": 48} if isinstance(props["size"], str): children[0].size = RADIX_TO_LUCIDE_SIZE[props["size"]] else: - children[0].size = Match.create( + size_map_var = Match.create( props["size"], *[(size, px) for size, px in RADIX_TO_LUCIDE_SIZE.items()], - "12px", + 12, ) + if not isinstance(size_map_var, Var): + raise ValueError(f"Match did not return a Var: {size_map_var}") + children[0].size = size_map_var return super().create(*children, **props) def add_style(self):