Skip to content

Commit

Permalink
simplify case where there's no var
Browse files Browse the repository at this point in the history
  • Loading branch information
adhami3310 committed Sep 24, 2024
1 parent 23fc0ff commit cbf6404
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions reflex/components/component.py
Original file line number Diff line number Diff line change
Expand Up @@ -497,9 +497,12 @@ def __init__(self, *args, **kwargs):
# Convert class_name to str if it's list
class_name = kwargs.get("class_name", "")
if isinstance(class_name, (List, tuple)):
kwargs["class_name"] = LiteralArrayVar.create(
class_name, _var_type=List[str]
).join(" ")
if any(isinstance(c, Var) for c in class_name):
kwargs["class_name"] = LiteralArrayVar.create(
class_name, _var_type=List[str]
).join(" ")
else:
kwargs["class_name"] = " ".join(class_name)
elif isinstance(class_name, str) and class_name:
kwargs["class_name"] = LiteralVar.create(class_name)

Expand Down

0 comments on commit cbf6404

Please sign in to comment.