webksde / drowl_base
DROWL Drupal (Base-)Theme based on Radix 6.x.
Requires
- drupal/core: ^10.2
- drupal/radix: 6.0.0-beta12
- drupal/twig_tweak: ^3.2
Suggests
- bower-asset/js-cookie: ^2; Necessary for this theme, but needs custom steps to be required, see https://www.drupal.org/docs/develop/using-composer/manage-dependencies#third-party-libraries
- drupal/blazy: Used and extended by this theme (optional).
- drupal/photoswipe: Used and extended by this theme (optional).
- drupal/slick: Used and extended by this theme (optional).
- npm-asset/simple-parallax-js: ^5; Necessary for this theme, but needs custom steps to be required, see https://www.drupal.org/docs/develop/using-composer/manage-dependencies#third-party-libraries
- 2.x-dev
- 2.0.0-alpha2
- 2.0.0-alpha1
- 1.x-dev
- 1.0.102
- 1.0.101
- 1.0.100
- 1.0.99
- 1.0.98
- 1.0.97
- 1.0.96
- 1.0.95
- 1.0.94
- 1.0.93
- 1.0.92
- 1.0.91
- 1.0.90
- 1.0.89
- 1.0.88
- 1.0.87
- 1.0.86
- 1.0.85
- 1.0.84
- 1.0.83
- 1.0.82
- 1.0.81
- 1.0.80
- 1.0.79
- 1.0.78
- 1.0.77
- 1.0.76
- 1.0.75
- 1.0.74
- 1.0.73
- 1.0.72
- 1.0.71
- 1.0.70
- 1.0.69
- 1.0.68
- 1.0.67
- 1.0.66
- 1.0.65
- 1.0.64
- 1.0.63
- 1.0.62
- 1.0.61
- 1.0.60
- 1.0.59
- 1.0.58
- 1.0.57
- 1.0.56
- 1.0.55
- 1.0.54
- 1.0.53
- 1.0.52
- 1.0.51
- 1.0.50
- 1.0.49
- 1.0.48
- 1.0.47
- 1.0.46
- 1.0.45
- 1.0.44
- 1.0.43
- 1.0.42
- 1.0.41
- 1.0.40
- 1.0.39
- 1.0.38
- 1.0.37
- 1.0.36
- 1.0.35
- 1.0.34
- 1.0.33
- 1.0.31
- 1.0.30
- 1.0.29
- 1.0.28
- 1.0.27
- 1.0.26
- 1.0.25
- 1.0.24
- 1.0.23
- 1.0.22
- 1.0.21
- 1.0.20
- 1.0.19
- 1.0.18
- 1.0.17
- 1.0.16
- 1.0.15
- 1.0.14
- 1.0.13
- 1.0.12
- 1.0.11
- 1.0.10
- 1.0.9
- 1.0.5
- 1.0.4
- 1.0.3
- 1.0.2
- 1.0.1
- dev-66-remove-duplicate-configuration-values
- dev-65-implement-missing-schema-definition
This package is auto-updated.
Last update: 2024-05-06 09:32:09 UTC
README
[TOC]
Helpful documentation
- Radix (Base Theme) Docs
- Drupal Single Directory Components (SDC) Docs
- Bootstrap 5 Docs
- Laravel Mix (Build Pipeline Library) Docs
Guidelines
- Follow the Drupal Guidelines: https://www.drupal.org/docs/develop/theming-drupal
- Use Components (SDC) for all reusable tempalte snippets
- With Bootstrap as a framework, we have to deal with two different conventions when it comes to CSS class naming. Drupal prefers BEM (https://getbem.com/naming), while Bootstrap uses some kind of OOCSS. We use this to our advantage, and use BEM for our custom page structure and components, so that we can better differentiate them. If it makes sense to use BEM classes next to Bootstrap classes, just do it. Example: 'page__navar navbar' are fine.
Extend Bootstrap
Components
Buttons
- btn-width-full: Stretches a button to 100% width (like the old btn-block class)
Helpers
Body classes
- current-breakpoint-is-x: Current active breakpoint determined by JS.
- current-breakpoint-is-smaller-x: If the current breakpoint is smaller brekpoint x.
- current-breakpoint-is-larger-x: If the current breakpoint is larger brekpoint x.
- current-vw-is-smaller-container-max: Set if the current viewport width is smaller as the BS .container (max. page width)
Javascript
Debounce / Throttle
Drupal.drowl_base.functions.debounce(function,delay);
// Example usage:
new ResizeObserver(Drupal.drowl_base.functions.debounce(function(){
// Do stuff!
}, 600));
Get current Breakpoint
// Returns: Breakpoint Name (string), example: "lg"
Drupal.drowl_base.functions.getCurrentBreakpoint();
Get Scrollbar width
// Returns: Pixel value (decimal), example: 15
Drupal.drowl_base.functions.getScrollbarWidth();
Events
Listen to viewport size changes
document.addEventListener(
"drowl_base:resize",
(e) => {
/* … */
},
false,
);
SDC Single Directory Components
Component Usage
Basically you have two ways to add a component:
Include
Include a component, and drop some parameters, but dont change its contents.
{% include 'drowl_base:block' with {
html_tag: 'section',
block_utility_classes: [
'my-3',
'block--local-tasks',
],
}%}
Embed
Include a component and change its contents using block overrides.
{% embed 'drowl_base:metaheader' with {
color: 'light',
navbar_utility_classes: ['bg-light'],
} %}
{% block left %}
Replacement
{% endblock %}
{% block right %}
Replacement
{% endblock %}
{% endembed %}
Create new Components
Prefer to use drush genrate:
drush generate theme:sdc:component
Override existing Components
Only themes can override components (modules cannot override). For a theme to override a component, use the replaces key within the mytheme.component.yml file.
Override DROWL Base Stylesheets
All stylesheets are written with CSS variables (where possible). So in most cases, you might only need to modify your SASS variables (so your drowl_child.variables.css file is updated).
If you need to modify or remove DROWL Base styles, you could simply remove or override the according Drupal library.
Libraries
Slick
DROWL Base has its own Slick Carousel theme, with various tweaks using CSS Variables.
Configuration variables
--grid-gutter: var(--bs-grid-gutter);
--direction-nav-top: calc(50% - (var(--dot-nav-reserved-outer-space) * 0.5));
--direction-nav-item-width: var(--icon-size-lg);
--direction-nav-item-height: var(--icon-size-lg);
--direction-nav-icon-size: var(--icon-size-md);
--direction-nav-item-bg: var(--bs-light-glass);
--direction-nav-item-color: var(--bs-dark-glass);
--direction-nav-item-bg-hover: var(--bs-light);
--direction-nav-item-color-hover: var(--bs-dark);
--dot-nav-item-width: var(--icon-size-xs);
--dot-nav-item-height: var(--icon-size-xs);
--dot-nav-item-radius: 50%;
--dot-nav-grid-gutter: .35rem;
--dot-nav-item-color: var(--bs-light-glass);
--dot-nav-item-color-hover: var(--bs-primary);
--dot-nav-item-color-active: var(--bs-white);
// Dot nav alignment, available options: start, center, end.
--dot-nav-alignment: center;
Check libraries/slick.scss for more details.
Controls outside
To show direction + dot nav outside the contents, use the class slick-controls-outside
on any wrapper, or .slick,
slick--controlsoutside
right on the .slick wrapper (prefered).
If slick__nav becomes > viewport width, it switches to the style defined by the CSS variable --direction-nav-outside-fallback-behavoir (could be: 'overlay','inset' or 'hide').
Controls inset
To show direction + dot nav outside the contents, while not moving the direction nav outside the container, use the class slick-controls-inset
on any wrapper, or .slick, slick--controlsinset
right on the .slick wrapper (prefered).
See libraries/slick.scss for details.
Allow Overflow
For slideshows which needs visible overflow (eg: because you have elements with box-shadow inside), you can set slick-allow-overflow
on any wrapper. Its very important to set slick-allow-overflow-parent
on the section
wrapper, to prevent the horizonal overflow. Otherwise the document will become horizontally scrollable.