Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Commit

Permalink
8.5.9
Browse files Browse the repository at this point in the history
- D8CORE-3161: moving pager css to theme (#242)
- D8CORE-4643: moving to a single filter by menu (#237)
- D8CORE-4714: adding the title description to the secondary menu links (#241)
- Updated font awesome library to 5.15.4
- D8CORE-4359 Adding an underline to the action-link (#238)
  • Loading branch information
pookmish authored Sep 3, 2021
2 parents 00d8c55 + 6874f75 commit 9e29701
Show file tree
Hide file tree
Showing 17 changed files with 322 additions and 17 deletions.
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# Stanford Basic Theme


8.x-5.9
--------------------------------------------------------------------------------
_Release Date: 2021-09-03

- D8CORE-3161: moving pager css to theme (#242)
- D8CORE-4643: moving to a single filter by menu (#237)
- D8CORE-4714: adding the title description to the secondary menu links (#241)
- Updated font awesome library to 5.15.4
- D8CORE-4359 Adding an underline to the action-link (#238)

8.x-5.8
--------------------------------------------------------------------------------
_Release Date: 2021-07-19_
Expand Down
2 changes: 1 addition & 1 deletion dist/css/components.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/js/behaviors.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 14 additions & 2 deletions src/js/stanford_basic.behavior.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ export default {
// Validate there is a skip link for the secondary navigation. If not,
// remove the skip link. If the mobile hamburger is visible, remove the link.
var $sn = $('#secondary-navigation', context).length;
var $pn = $('.menu--stanford-publication-topics', context).length;
if (!$sn && !$pn) {
if (!$sn) {
$('.su-skipnav--secondary', context).remove();
}

Expand Down Expand Up @@ -78,6 +77,19 @@ export default {
}
}

/**
* Open and close on the filter menu: News, People, Publications, Events
*/
$('.topics__collapsable-menu', context).click(function () {
$(this).toggleClass('show');
if ($(this).siblings('.menu').css('display') != 'none') {
$(this).attr('aria-expanded', 'true');
}
else {
$(this).attr('aria-expanded', 'false');
}
});

})(jQuery);
},

Expand Down
17 changes: 17 additions & 0 deletions src/scss/components/all/_link--pager.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
@charset 'UTF-8';

// Load more button used on filtered pages and
// paragraph lists.

.js-pager__items {
text-align: center;

.pager__item {
display: inline-block;

.button {
@include button-primary;
}
}
}

3 changes: 2 additions & 1 deletion src/scss/components/all/index.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@charset 'UTF-8';

@import 'vertical-spacing';
@import 'link--pager';
@import 'vertical-spacing';
156 changes: 156 additions & 0 deletions src/scss/components/filter-menu/_filter-menu.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
@charset "UTF-8";

//
// Filter menu
//

// Changing the layout for the filtered pages.
@include grid-media-max('lg') {
.left-region {
&.flex-lg-3-of-12 {
flex: auto;
max-width: 100%;
}
}
}

.filter-menu {
@include modular-spacing('padding', 3);

border: 1px solid $su-color-cool-grey-25;

.topics__collapsable-menu {
@include type-e;
@include padding(0);

background-color: transparent;
color: $su-color-bright-blue;
cursor: pointer;
display: inline-block;
font-weight: $su-font-semi-bold;
text-align: left;
text-decoration: none;
width: 100%;

@include grid-media('xl') {
@include modular-spacing('margin-bottom', 2);
}

&.show {
@include modular-spacing('margin-bottom', 2);

@include grid-media('xl') {
margin-bottom: 0;

& + .menu {
& > li {
&.menu-item {
&:last-of-type {
padding-bottom: 0;
}
}
}
}
}
}

&:hover,
&:focus {
text-decoration: underline;
}

.su-link--jump {
float: right;
}

@include grid-media-max('lg') {
&::before {
@include small-paragraph;
@include padding(null 15px null null);

color: $su-color-bright-blue;
content: "\f1de"; // Placeholder Icon until SU ones in place.
font-family: 'Font Awesome 5 Free';
font-weight: $su-font-semi-bold; // Need this for the new version of FA. Will go away later.
}
}
}

.menu {
@include margin(0);
@include padding(0);

.menu-item {
@include modular-spacing('padding-bottom', 2);
@include modular-spacing('padding-left', 0);
@include small-paragraph;

a {
color: $su-color-black;
text-decoration: none;

&:hover,
&:focus {
text-decoration: underline;
}
}
}

& > li {
&.menu-item {
&:last-of-type {
padding-bottom: 0;
}
}
}

.menu-item--active-trail {
&::before {
@include small-paragraph;

color: $su-color-bright-blue;
content: "\f00c"; ///* Need to switch to the SU icons.
font-family: 'Font Awesome 5 Free';
font-weight: $su-font-semi-bold; // Need this for the new version of FA. Will go away later.
left: 35px;
position: absolute;
}

.is-active {
color: $su-color-bright-blue;
}
}
}

// Filter open/close for xs-lg
@include grid-media-max('lg') {
.menu {
display: none;
}

.topics__collapsable-menu {
&.show {
& + .menu {
display: block;
}
}
}
}


// Filter open/close for xl
@include grid-media('xl') {
.menu {
display: block;
}

.topics__collapsable-menu {
&.show {
+ .menu {
display: none;
}
}
}
}

}
7 changes: 7 additions & 0 deletions src/scss/components/filter-menu/index.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
@charset "UTF-8";

///
/// ROLL UP
///

@import 'filter-menu';
2 changes: 2 additions & 0 deletions src/scss/components/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
@import
'all/index', // All comes first so others can override.
'alert/index',
'filter-menu/index',
'link/index.scss',
'lockup/index',
'masthead/index',
'multi-menu/index',
Expand Down
11 changes: 11 additions & 0 deletions src/scss/components/link/_link--action.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
@charset "UTF-8";

.su-link--action {

&:hover,
&:active,
&:focus {
text-decoration: underline;
}

}
7 changes: 7 additions & 0 deletions src/scss/components/link/index.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
@charset "UTF-8";

///
/// ROLL UP
///

@import 'link--action'
2 changes: 1 addition & 1 deletion stanford_basic.info.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: 'Stanford Basic'
type: theme
description: 'Stanford Basic Branding Theme.'
package: Stanford
version: 8.x-5.8
version: 8.x-5.9
core_version_requirement: ^9
'base theme': stable9
regions:
Expand Down
6 changes: 3 additions & 3 deletions stanford_basic.libraries.yml
Original file line number Diff line number Diff line change
Expand Up @@ -130,11 +130,11 @@ user_login:
dist/css/user_login.css: { }

fontawesome:
version: 5.7.1
remote: https://use.fontawesome.com/releases/v5.7.1/css/all.css
version: 5.15.4
remote: https://use.fontawesome.com/releases/v5.15.4/css/all.css
license:
name: FontAwesome
url: http://fontawesome.io/license/
css:
base:
//use.fontawesome.com/releases/v5.7.1/css/all.css: {}
//use.fontawesome.com/releases/v5.15.4/css/all.css: {}
15 changes: 15 additions & 0 deletions stanford_basic.theme
Original file line number Diff line number Diff line change
Expand Up @@ -334,3 +334,18 @@ function stanford_basic_preprocess_menu_local_task(&$variables) {
$variables['attributes']['class'][] = 'page-content-label';
}
}

/**
* Implements hook_theme_suggestions_HOOK_alter().
*/
function stanford_basic_theme_suggestions_block_alter(array &$suggestions, array $variables) {
if ($variables['elements']['#base_plugin_id'] == 'system_menu_block') {
$taxonomy_menu = \Drupal::entityTypeManager()
->getStorage('taxonomy_menu')
->loadByProperties(['menu' => $variables['elements']['#derivative_plugin_id']]);
if (!empty($taxonomy_menu)) {
$suggestions[] = 'block__system_menu_block__filter_by';
}
}
}

68 changes: 68 additions & 0 deletions templates/block/block--system-menu-block--filter-by.html.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
{#
/**
* @file
* Theme override for a menu block.
*
* Available variables:
* - plugin_id: The ID of the block implementation.
* - label: The configured label of the block if visible.
* - configuration: A list of the block's configuration values.
* - label: The configured label for the block.
* - label_display: The display settings for the label.
* - provider: The module or other provider that provided this block plugin.
* - Block plugin specific settings will also be stored here.
* - content: The content of this block.
* - attributes: HTML attributes for the containing element.
* - id: A valid HTML ID and guaranteed unique.
* - title_attributes: HTML attributes for the title element.
* - content_attributes: HTML attributes for the content element.
* - title_prefix: Additional output populated by modules, intended to be
* displayed in front of the main title tag that appears in the template.
* - title_suffix: Additional output populated by modules, intended to be
* displayed after the main title tag that appears in the template.
*
* Headings should be used on navigation menus that consistently appear on
* multiple pages. When this menu block's label is configured to not be
* displayed, it is automatically made invisible using the 'visually-hidden' CSS
* class, which still keeps it visible for screen-readers and assistive
* technology. Headings allow screen-reader and keyboard only users to navigate
* to or skip the links.
* See http://juicystudio.com/article/screen-readers-display-none.php and
* http://www.w3.org/TR/WCAG-TECHS/H42.html for more information.
*/
#}
{%
set classes = [
'block',
'block-menu',
'navigation',
'menu--' ~ derivative_plugin_id|clean_class,
'filter-menu',
]
%}
{% set menu_class = 'topics__collapsable-menu' %}
{% set heading_id = (configuration.id ~ '-menu')|clean_id %}
{% set attributes = attributes.setAttribute('id', heading_id) %}
{% set button_label = ('button-label')|clean_id %}
{% set attributes = attributes.setAttribute('aria-labelledby', button_label) %}
{% set attributes = attributes.addClass(classes) %}

<a href="#main-content" class="visually-hidden focusable su-skipnav su-skipnav--content">{{ 'Skip to main content'|t }}</a>
<nav{{ attributes }}>
<div id="secondary-navigation" tabindex="-1" class="visually-hidden focusable">{{ 'Secondary Navigation'|t }}</div>
{# Label. If not displayed, we still provide it for screen readers. #}
{% if not configuration.label_display %}
{% set title_attributes = title_attributes.addClass('visually-hidden') %}
{% endif %}
{{ title_prefix }}
<button{{ title_attributes.setAttribute('class', menu_class).setAttribute('id', button_label) }}>
{{ configuration.label }}
<span class="su-link su-link--jump"></span>
</button>
{{ title_suffix }}

{# Menu. #}
{% block content %}
{{ content }}
{% endblock %}
</nav>
8 changes: 0 additions & 8 deletions templates/block/block--system-menu-block.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,7 @@
]
%}
{% set heading_id = (configuration.id ~ '-menu')|clean_id %}
{# For Publications adding the skip links to the side menu but not other cases. #}
{% set url = url('<current>') %}
{% if 'publications' in url|render|render %}
<a href="#main-content" class="visually-hidden focusable su-skipnav su-skipnav--content">{{ 'Skip to main content'|t }}</a>
{% endif %}
<div {{ attributes.addClass(classes) }}>
{% if 'publications' in url|render|render %}
<div id="secondary-navigation" tabindex="-1" class="visually-hidden focusable">{{ 'Secondary Navigation'|t }}</div>
{% endif %}
{# Label. If not displayed, we still provide it for screen readers. #}
{% if not configuration.label_display %}
{% set title_attributes = title_attributes.addClass('visually-hidden') %}
Expand Down
Loading

0 comments on commit 9e29701

Please sign in to comment.