Repository navigation
feat(shiny-preset): Dashboard design in all page layouts - #897
Merged
Merged
Conversation
And attach lighter border colors to this variable
cpsievert
reviewed
Nov 6, 2023
cpsievert
reviewed
Nov 6, 2023
cpsievert
reviewed
Nov 6, 2023
cpsievert
reviewed
Nov 6, 2023
cpsievert
reviewed
Nov 6, 2023
If replicating navbar/sidebar, you can use the `.bslib-page-{navbar,sidebar}` classes instead.
This makes `.bslib-page-dashboard` a way to access everything except the main content area background color.
gadenbuie
marked this pull request as draft
November 6, 2023 22:31
…ound and border * sidebar layout is removed from shadow considerations * all cards get same color treatment * only top-level cards get shadows * sidebar/navbar pages detect their main content area * .bslib-page-dashboard can be used to replicate those layouts * or .bslib-page-dashboard in conjunction with `.main` class can be used to set where the main gray bg content area is
was `$bslib-enable-dashboard`
bslib-enable-dashboard Sass variable$bslib-dashboard-design Sass variable
$bslib-dashboard-design Sass variableAlso there shouldn't be a `main` within a `main` (only one main per page)
cpsievert
reviewed
Nov 9, 2023
cpsievert
reviewed
Nov 9, 2023
cpsievert
approved these changes
Nov 9, 2023
cpsievert
left a comment
Collaborator
There was a problem hiding this comment.
Awesome work, thank you! Feel free to merge once the last couple comments are addressed
…parate from dashboard design
* Put it on the container with the dashboard/sidebar/navbar class * Make first sidebar layout main area transparent * Make navbar and title backgrounds --body-bg
Member
Author
|
@cpsievert I was nagged by a thought about the background color implementation and ended up changing it a bit last night. I thought you might want to take another look before we merge this. The new strategy:
**There's a separate issue that |
Collaborator
|
@gadenbuie LGTM 👍 |
gadenbuie
marked this pull request as ready for review
November 10, 2023 16:28
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This PR primarily brings the "dashboard" design look to all
page_*()functions. Previously, these were limited to the main content areas ofpage_navbar()andpage_sidebar(), but this led to inconsistent styles when using the other page functions.The dashboard design is behind a
$bslib-dashboard-designSass variable in thepreset="shiny"theme so that it could (in theory) be used to turn on and off the dashboard styles entirely. This might be relevant for matching Quarto's theme, or for using a more classic Bootstrap look with the rest of the shiny preset customizations.The dashboard design brings:
page_navbar()andpage_sidebar().page_navbar()andpage_sidebar().When using other page functions, e.g.
page_fillable()orpage_fixed(), all cards are now styled consistently. In these functions, where the user has complete control over the elements on the page, a.bslib-page-dashboardclass can be added. Ideally this class would be added at the<body>level, but that will require the work in #899 to be user-accessible..bslib-page-dashboardcan also be used on a region of the page, e.g. in an area containing alayout_sidebar().Remaining tasks
Allow setting attributes at the page level, especially
classandstyle#899page_fillable(). This will be handled in a follow-up PR.Value boxes should inherit their border and shadow from generic card styles
border-autoclass and logic).Create a test app for screenshot testing of the many combinations of pages and layouts.
$bslib-dashboard-design.bslib-page-dashboardI also added a
.bslib-page-dashboardclass that can be used in the otherpage_*()functions to recreate or re-use the dashboard styles. Ideally this class is added to the body element of the page, in which case the page receives the gray background. This class can also be used withpage_fillable()and custom layouts that replicate the features ofpage_sidebar()orpage_navbar().In some page functions, like
page_fluid(), theclassattribute is applied to a container div and not<body>, so you may need to manually create thebodytag, as below.In a previous iteration of this PR,
.bslib-page-dashboardwould set the background color of the.mainelement, but I've simplified the logic. The class, like.bslib-page-navbarand.bslib-page-sidebar, now applies the background color to the container on which it is placed. Ideally that's the<body>element. It then finds the first sidebar layout and makes the background of its main content area transparent – unless the user has customized the sidebar layout with thebgargument. The explanation may sound complicated, but both the user interface and the CSS rules are simpler.