Skip to content

Commit

Permalink
Close #492. Deprecate nav() in favor of nav_panel()
Browse files Browse the repository at this point in the history
  • Loading branch information
cpsievert committed Dec 7, 2023
1 parent a5de5fa commit 814c636
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 4 deletions.
6 changes: 4 additions & 2 deletions shiny/ui/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
from ._markdown import markdown
from ._modal import modal_button, modal, modal_show, modal_remove
from ._navs import (
nav,
nav_panel,
nav_menu,
nav_control,
nav_spacer,
Expand All @@ -102,6 +102,7 @@
# Deprecated
navset_pill_card,
navset_tab_card,
nav,
)
from ._notification import notification_show, notification_remove
from ._output import (
Expand Down Expand Up @@ -267,7 +268,7 @@
"modal_show",
"modal_remove",
# _navs
"nav",
"nav_panel",
"nav_menu",
"nav_control",
"nav_spacer",
Expand All @@ -283,6 +284,7 @@
# # Deprecated
"navset_pill_card",
"navset_tab_card",
"nav",
# _notification
"notification_show",
"notification_remove",
Expand Down
26 changes: 24 additions & 2 deletions shiny/ui/_navs.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from __future__ import annotations

__all__ = (
"nav",
"nav_panel",
"nav_menu",
"nav_control",
"nav_spacer",
Expand All @@ -17,6 +17,7 @@
# Deprecated - 2023-08-15
"navset_pill_card",
"navset_tab_card",
"nav",
)

import copy
Expand Down Expand Up @@ -98,7 +99,7 @@ def tagify(self) -> None:


@add_example()
def nav(
def nav_panel(
title: TagChild,
*args: TagChild,
value: Optional[str] = None,
Expand Down Expand Up @@ -1394,3 +1395,24 @@ def navset_tab_card(
header=header,
footer=footer,
)


# Deprecated 2023-12-07
def nav(
title: TagChild,
*args: TagChild,
value: Optional[str] = None,
icon: TagChild = None,
) -> Nav:
"""Deprecated. Please use `nav_panel()` instead of `nav()`."""
warn_deprecated(
"`nav()` is deprecated. "
"This method will be removed in a future version, "
"please use :func:`~shiny.ui.nav_panel` instead."
)
return nav_panel(
title,
*args,
value=value,
icon=icon,
)

0 comments on commit 814c636

Please sign in to comment.