-
Notifications
You must be signed in to change notification settings - Fork 58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(shiny-preset): Dashboard design in all page layouts #897
Conversation
And attach lighter border colors to this variable
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.
…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)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
@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 |
@gadenbuie LGTM 👍 |
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-design
Sass 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-dashboard
class 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-dashboard
can 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
class
andstyle
#899page_fillable()
. This will be handled in a follow-up PR.Value boxes should inherit their border and shadow from generic card styles
border-auto
class and logic).Create a test app for screenshot testing of the many combinations of pages and layouts.
$bslib-dashboard-design
.bslib-page-dashboard
I also added a
.bslib-page-dashboard
class 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()
, theclass
attribute is applied to a container div and not<body>
, so you may need to manually create thebody
tag, as below.In a previous iteration of this PR,
.bslib-page-dashboard
would set the background color of the.main
element, but I've simplified the logic. The class, like.bslib-page-navbar
and.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 thebg
argument. The explanation may sound complicated, but both the user interface and the CSS rules are simpler.