Allow express' layout.sidebar to handle inline layouts
#847
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes #841
Closes #846
This PR does 3 things:
page_fillable()(see Consider makingpage_fillable()the default forshiny.express#846 for motivation)express.layout.sidebar()to be an interface tolayout_sidebar(), notsidebar().layout_sidebar()to accept aTagChildfor it's first argument (sidebar) and wraps that value in asidebar()if need be.As a result of 2 and 3, we gain the following:
with layout.sidebar()appears anywhere but the first top-level component, you'll get a error / undefined behavior.with layout.sidebar()in a meaningful waywith layout.sidebar()as a single, top-level, component still fills the page sensiblywith layout.sidebar()now works sensibly as an inline sidebar layout, just likeui.layout_sidebar()does.The main downside to this approach is that it may be surprising that code like this produces "Thing 1" in the sidebar, but "Thing 2"/"Thing 3" in the main region:
And to place multiple elements in the sidebar, you need an explicit
ui.sidebar()That seems reasonable though, especially considering it seems as though we'll be needing this sort of pattern for other components, like cards: