Default rx.link
href to #
so underline prop works (#4509)
This commit is contained in:
parent
4ecb0b81ce
commit
05b791653e
@ -77,13 +77,14 @@ class Link(RadixThemesComponent, A, MemoizationLeaf, MarkdownComponentMap):
|
|||||||
Component: The link component
|
Component: The link component
|
||||||
"""
|
"""
|
||||||
props.setdefault(":hover", {"color": color("accent", 8)})
|
props.setdefault(":hover", {"color": color("accent", 8)})
|
||||||
|
href = props.get("href")
|
||||||
|
|
||||||
is_external = props.pop("is_external", None)
|
is_external = props.pop("is_external", None)
|
||||||
|
|
||||||
if is_external is not None:
|
if is_external is not None:
|
||||||
props["target"] = cond(is_external, "_blank", "")
|
props["target"] = cond(is_external, "_blank", "")
|
||||||
|
|
||||||
if props.get("href") is not None:
|
if href is not None:
|
||||||
if not len(children):
|
if not len(children):
|
||||||
raise ValueError("Link without a child will not display")
|
raise ValueError("Link without a child will not display")
|
||||||
|
|
||||||
@ -101,6 +102,9 @@ class Link(RadixThemesComponent, A, MemoizationLeaf, MarkdownComponentMap):
|
|||||||
as_child=True,
|
as_child=True,
|
||||||
**props,
|
**props,
|
||||||
)
|
)
|
||||||
|
else:
|
||||||
|
props["href"] = "#"
|
||||||
|
|
||||||
return super().create(*children, **props)
|
return super().create(*children, **props)
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user