Skip to content

Commit

Permalink
chore: Use as_fill_item(as_fillable_container(main))
Browse files Browse the repository at this point in the history
  • Loading branch information
gadenbuie committed Jul 16, 2024
1 parent 0e01c66 commit 5bbe19e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 18 deletions.
9 changes: 3 additions & 6 deletions shiny/ui/_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
from ._tag import consolidate_attrs
from ._utils import get_window_title
from .css import CssUnit, as_css_padding, as_css_unit
from .fill._fill import add_fill_classes, as_fillable_container
from .fill._fill import as_fill_item, as_fillable_container

page_sidebar_default: SidebarOpen = SidebarOpen(desktop="open", mobile="always")

Expand Down Expand Up @@ -144,11 +144,8 @@ def page_sidebar(


def page_main_container(*args: TagChild) -> Tag:
return add_fill_classes(
tags.main({"class": "bslib-page-main bslib-gap-spacing"}, *args),
fill_item=True,
fillable_container=True,
)
main = tags.main({"class": "bslib-page-main bslib-gap-spacing"}, *args)
return as_fillable_container(as_fill_item(main))


@no_example()
Expand Down
12 changes: 0 additions & 12 deletions shiny/ui/fill/_fill.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,15 +215,3 @@ def is_fill_item(tag: object) -> bool:
# renders_to_tag_class(x, FILL_ITEM_CLASS, ".html-widget")

return isinstance(tag, Tag) and tag.has_class(FILL_ITEM_CLASS)


def add_fill_classes(
tag: Tag, fill_item: bool = True, fillable_container: bool = True
) -> Tag:
if fill_item:
tag.add_class(FILL_ITEM_CLASS)
if fillable_container:
tag.add_class(FILL_CONTAINER_CLASS)
if fill_item or fillable_container:
tag.append(fill_dependency())
return tag

0 comments on commit 5bbe19e

Please sign in to comment.