Use flexbox to position and space dashboard panes

This commit is contained in:
Paul Weidner 2023-09-07 10:53:06 -07:00 committed by Michael Stenta
parent 74dfee5024
commit a195744803
6 changed files with 34 additions and 14 deletions

View File

@ -1,8 +0,0 @@
.layout--twocol .layout__region {
box-sizing: border-box;
overflow-x: scroll;
}
.layout--twocol .layout__region--first {
padding-right: 1.5em;
}

View File

@ -1,4 +0,0 @@
dashboard_layout:
css:
theme:
css/dashboard_layout.css: { }

View File

@ -185,8 +185,6 @@ class DashboardController extends ControllerBase {
// Build the layout.
$render = $layoutInstance->build($regions);
// Add the dashboard_layout styles.
$render['#attached']['library'][] = 'farm_ui_dashboard/dashboard_layout';
return $render;
}

View File

@ -0,0 +1,23 @@
/* Add a gap between layout regions. */
.layout--twocol {
--dashboard-spacing: var(--gin-spacing-s);
gap: var(--dashboard-spacing);
}
/* Use flexbox within each region. */
.layout--twocol .layout__region,
.layout--twocol .layout__region {
flex-basis: 100%;
display: flex;
flex-direction: column;
gap: var(--dashboard-spacing);
}
/* Split first and second regions to two columns on large screens. */
@media (min-width: 48em) {
.layout--twocol .layout__region--first,
.layout--twocol .layout__region--second {
flex-basis: 50%;
max-width: calc(50% - var(--dashboard-spacing)*.5);
}
}

View File

@ -2,6 +2,10 @@ asset_map_popup:
css:
theme:
css/asset_map_popup.css: { }
dashboard:
css:
theme:
css/dashboard.css: { }
flag:
css:
theme:

View File

@ -109,6 +109,13 @@ function farm_ui_theme_preprocess_log__full(&$variables) {
$variables['#attached']['library'][] = 'farm_ui_theme/layout';
}
/**
* Implements hook_preprocess_HOOK().
*/
function farm_ui_theme_preprocess_page__dashboard(&$variables) {
$variables['#attached']['library'][] = 'farm_ui_theme/dashboard';
}
/**
* Implements hook_preprocess_HOOK().
*/