Skip to content
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

Merged
merged 26 commits into from
Nov 10, 2023
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
5883301
feat(shiny-preset): Add `bslib-enable-dashboard` Sass variable
gadenbuie Nov 6, 2023
f50ba10
Resave distributed files (GitHub Action)
gadenbuie Nov 6, 2023
6f4df26
feat(dashboard): Add `.bslib-page-dashboard` class
gadenbuie Nov 6, 2023
9662636
`devtools::document()` (GitHub Actions)
gadenbuie Nov 6, 2023
e1242b2
Resave distributed files (GitHub Action)
gadenbuie Nov 6, 2023
1afdbfd
fix(shiny-preset): Don't add shadows if dashboard enable but shadows off
gadenbuie Nov 6, 2023
f89f79e
refactor(shiny-preset): Rename `bslib-box-shadows` mixin to `bslib-da…
gadenbuie Nov 6, 2023
1efec0a
fix(shiny-preset): Disable shadows in nested cards/sidebars
gadenbuie Nov 6, 2023
02984bb
fix(shiny-preset): Match font-size of card header and footer
gadenbuie Nov 6, 2023
a72ad97
feat: Focus `.bslib-page-dashboard` on non-navbar/sidebar cases
gadenbuie Nov 6, 2023
e8c863a
Resave distributed files (GitHub Action)
gadenbuie Nov 6, 2023
555a9d2
refactor(shiny-preset): Use css variable to handle shadow color chang…
gadenbuie Nov 8, 2023
c98b119
refactor: Card styles are global, .bslib-page-dashboard is for backgr…
gadenbuie Nov 9, 2023
ded5771
fix: all card box-shadow logic in one place
gadenbuie Nov 9, 2023
5b4825a
feat: `.bslib-page-dashboard` on the body marks the main content area
gadenbuie Nov 9, 2023
3246086
refactor: Rename to `$bslib-dashboard-design`
gadenbuie Nov 9, 2023
6ef2e57
Resave distributed files (GitHub Action)
gadenbuie Nov 9, 2023
7c4959c
feat: support `main.bslib-page-dashboard` too
gadenbuie Nov 9, 2023
6fa72e1
feat(shadows): Add sm/md/lg shadows, utility classes, make shadows se…
gadenbuie Nov 10, 2023
ac5f0c4
refactor: Simplify where grey background color is set
gadenbuie Nov 10, 2023
1683378
refactor: Remove unneeded border-top from the sidebars in cards
gadenbuie Nov 10, 2023
8c774b6
`devtools::document()` (GitHub Actions)
gadenbuie Nov 10, 2023
1e37e4b
Resave distributed files (GitHub Action)
gadenbuie Nov 10, 2023
bf31e3c
Resave data (GitHub Action)
gadenbuie Nov 10, 2023
c520ae1
docs: add news item
gadenbuie Nov 10, 2023
91888b1
`devtools::document()` (GitHub Actions)
gadenbuie Nov 10, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 39 additions & 21 deletions inst/builtin/bs5/shiny/_rules.scss
Original file line number Diff line number Diff line change
Expand Up @@ -71,24 +71,26 @@ $bslib-checkbox-radio-margin-right: 0.35em !default;
}


@mixin bslib-box-shadows {
@mixin bslib-dashboard-cards {

// Add box-shadow & remove border from 'top-level' card()/layout_sidebar()
.bslib-card, .bslib-sidebar-layout {
// Shadows on top-level cards/sidebars, not in nested components
box-shadow: $box-shadow;
@if ($bslib-enable-shadows) {
cpsievert marked this conversation as resolved.
Show resolved Hide resolved
gadenbuie marked this conversation as resolved.
Show resolved Hide resolved
// Add box-shadow & remove border from 'top-level' card()/layout_sidebar()
.bslib-card, .bslib-sidebar-layout {
box-shadow: none;
}
// Shadows on top-level cards/sidebars, not in nested components
box-shadow: $box-shadow;
.bslib-card, .bslib-sidebar-layout {
box-shadow: none;
}

// Remove outer border, but keep inner borders and borders on nested components
border-width: 0;
// Remove outer border, but keep inner borders and borders on nested components
border-width: 0;

// We're deliberately avoiding `@include color-mode(dark)` here since
// that'd require a fair amount of duplication to properly implement
// https://github.com/rstudio/bslib/pull/829/files#r1361262514
[data-#{$prefix}theme="dark"] & {
box-shadow: $box-shadow-dark;
// We're deliberately avoiding `@include color-mode(dark)` here since
// that'd require a fair amount of duplication to properly implement
// https://github.com/rstudio/bslib/pull/829/files#r1361262514
[data-#{$prefix}theme="dark"] & {
box-shadow: $box-shadow-dark;
}
}
}

Expand All @@ -111,34 +113,50 @@ $bslib-checkbox-radio-margin-right: 0.35em !default;

// TODO: move this logic into a "core" bundle that comes with any theme
// (but you only get the shadows by default in the preset theme)
@if $bslib-enable-shadows {
@if $bslib-enable-dashboard {

:root {
--bslib-dashboard-main-bg: rgba(var(--#{$prefix}emphasis-color-rgb, 0,0,0), 0.03);
--bslib-dashboard-sidebar-bg: var(--#{$prefix}body-bg);
--bslib-dashboard-sidebar-main-bg: var(--#{$prefix}body-bg);
--bslib-dashboard-border-color-translucent: #{$bslib-dashboard-border-color-translucent};
--bslib-dashboard-border-color-translucent-dark: #{$bslib-dashboard-border-color-translucent-dark};
}

.bslib-page-sidebar, .bslib-page-navbar, .bslib-page-dashboard {
--#{$prefix}border-color-translucent: var(--bslib-dashboard-border-color-translucent, #{$border-color-translucent});
}
@include color-mode(dark) {
.bslib-page-sidebar, .bslib-page-navbar, .bslib-page-dashboard {
--#{$prefix}border-color-translucent: var(--bslib-dashboard-border-color-translucent-dark, #{$border-color-translucent-dark});
}
}

.bslib-page-sidebar, .bslib-page-navbar {
.bslib-page-sidebar, .bslib-page-navbar, .bslib-page-dashboard {
cpsievert marked this conversation as resolved.
Show resolved Hide resolved
.bslib-sidebar-layout {
--bslib-sidebar-bg: var(--bslib-dashboard-sidebar-bg);
--bslib-sidebar-main-bg: var(--bslib-dashboard-sidebar-main-bg);
}
}

.bslib-page-sidebar {
.bslib-page-dashboard {
&, & > .bslib-grid > .bslib-grid-item {
@include bslib-dashboard-cards;
}
}
gadenbuie marked this conversation as resolved.
Show resolved Hide resolved

.bslib-page-sidebar, .bslib-page-dashboard {
gadenbuie marked this conversation as resolved.
Show resolved Hide resolved
--bslib-page-sidebar-title-bg: transparent;
--bslib-page-sidebar-title-color: var(--#{$prefix}body-color);
> .bslib-sidebar-layout {
--bslib-sidebar-main-bg: var(--bslib-dashboard-main-bg);
> .main {
@include bslib-box-shadows;
@include bslib-dashboard-cards;
}
}
}

.bslib-page-navbar {

.bslib-page-navbar, .bslib-page-dashboard {
cpsievert marked this conversation as resolved.
Show resolved Hide resolved
> .navbar {
--bslib-navbar-default-bg: transparent;
--bslib-navbar-inverse-bg: var(--#{$prefix}body-color);
gadenbuie marked this conversation as resolved.
Show resolved Hide resolved
Expand All @@ -155,7 +173,7 @@ $bslib-checkbox-radio-margin-right: 0.35em !default;
border-top: none !important; // Make sure we don't end up w/ a double border
--bslib-sidebar-main-bg: var(--bslib-dashboard-main-bg);
> .main {
@include bslib-box-shadows;
@include bslib-dashboard-cards;
}
}
}
Expand Down
11 changes: 6 additions & 5 deletions inst/builtin/bs5/shiny/_variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -111,14 +111,15 @@ $box-shadow-dark:
// Cards
$card-border-radius: 8px !default;

// Borders
$border-color-translucent: RGBA(40, 70, 94, 0.1) !default;
$border-color-translucent-dark: RGBA(255, 255, 255, 0.1) !default;

// bslib variables
$bslib-enable-shadows: true !default;
$bslib-enable-dashboard: true !default;
$bslib-enable-shadows: $bslib-enable-dashboard !default
$bslib-value-box-enable-shadow: $bslib-enable-shadows !default;

// bslib Dashboard Styles
$bslib-dashboard-border-color-translucent: RGBA(40, 70, 94, 0.1) !default;
$bslib-dashboard-border-color-translucent-dark: RGBA(255, 255, 255, 0.1) !default;

// Modals
$modal-dialog-margin-y-sm-up: 10% !default;
$modal-header-border-width: none !default;
Expand Down
2 changes: 1 addition & 1 deletion inst/css-precompiled/5/bootstrap.min.css

Large diffs are not rendered by default.

Binary file modified man/figures/navset-card-pill.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified man/figures/navset-card-underline.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified man/figures/navset-pill-list.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified man/figures/navset-pill.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified man/figures/navset-tab-card.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified man/figures/navset-tab.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified man/figures/navset-underline.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading