Skip to content

Commit

Permalink
Finished mobile news submenu, added submenu to news collections, fixe…
Browse files Browse the repository at this point in the history
…d soeopsfy24-151
  • Loading branch information
imonroe committed Aug 19, 2024
1 parent d656547 commit b375fb7
Show file tree
Hide file tree
Showing 7 changed files with 280 additions and 68 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@ dependencies:
- taxonomy.vocabulary.article_collection
- views.view.magazine_article_collection
module:
- engineering_magazine
- jumpstart_ui
- layout_builder
- layout_builder_restrictions
- layout_discovery
- layout_library
- text
Expand All @@ -21,6 +23,24 @@ third_party_settings:
enabled: true
allow_custom: false
sections:
-
layout_id: layout_onecol
layout_settings:
label: ''
context_mapping: { }
components:
cee77444-0c4b-49f2-b00e-47ab47e094bb:
uuid: cee77444-0c4b-49f2-b00e-47ab47e094bb
region: content
configuration:
id: magazine_navigation_block
label: 'Magazine Navigation'
label_display: '0'
provider: engineering_magazine
context_mapping: { }
weight: 0
additional: { }
third_party_settings: { }
-
layout_id: defaults
layout_settings:
Expand Down Expand Up @@ -48,7 +68,7 @@ third_party_settings:
third_party_settings:
field_formatter_class:
class: soe-article-collection__description
weight: 1
weight: 2
additional: { }
58192dcf-53c4-4c4a-bc95-405316b82870:
uuid: 58192dcf-53c4-4c4a-bc95-405316b82870
Expand All @@ -69,7 +89,7 @@ third_party_settings:
third_party_settings:
field_formatter_class:
class: ''
weight: 0
weight: 1
additional: { }
6c711023-7e35-4849-92a4-76901df9a78c:
uuid: 6c711023-7e35-4849-92a4-76901df9a78c
Expand All @@ -90,7 +110,7 @@ third_party_settings:
third_party_settings:
field_formatter_class:
class: ''
weight: 2
weight: 3
additional: { }
third_party_settings: { }
-
Expand All @@ -114,6 +134,13 @@ third_party_settings:
third_party_settings: { }
layout_library:
enable: false
layout_builder_restrictions:
allowed_block_categories: { }
entity_view_mode_restriction:
allowed_layouts: { }
denylisted_blocks: { }
allowlisted_blocks: { }
restricted_categories: { }
id: taxonomy_term.article_collection.default
targetEntityType: taxonomy_term
bundle: article_collection
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,50 @@ var __webpack_exports__ = {};
topicsItem.removeClass('active');
}
});
var mobileToggle = $('#mobile-magazine-landing-nav__toggle');
mobileToggle.click(function () {
$('.news-navigation-bar__container').slideToggle(100, function () {
if ($(this).is(':visible')) {
$(this).css('display', 'flex');
}
});
if (mobileToggle.attr('aria-expanded') == 'false') {
mobileToggle.attr('aria-expanded', 'true');
mobileToggle.removeClass('soe-magazine__navigation-rotate-down');
mobileToggle.addClass('soe-magazine__navigation-rotate-up');
} else {
mobileToggle.attr('aria-expanded', 'false');
mobileToggle.removeClass('soe-magazine__navigation-rotate-up');
mobileToggle.addClass('soe-magazine__navigation-rotate-down');
}
});
function reorderElements() {
var windowWidth = $(window).width();
if (windowWidth < 768) {
// Reorder for mobile view (less than 768px)
$(".magazine-landing-nav__topics-panel").insertAfter(".topics_item");
} else {
// Reorder back for larger viewports
$(".magazine-landing-nav__topics-panel").insertAfter(".news-navigation-bar");
$(".news-navigation-bar__container").show();
}
}
function fixNewsActivePath() {
var path = window.location.pathname;
// Check if the URL contains the substring '/news/'
if (path.indexOf('/news/') !== -1) {
$('a.su-multi-menu__link[href="/news"]').closest('li').addClass('su-multi-menu__item--active-trail');
}
}

// Run on document ready
reorderElements();
fixNewsActivePath();

// Run on window resize
$(window).resize(function () {
reorderElements();
});
}
};
})(jQuery, Drupal);
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,55 @@
}
});

const mobileToggle = $('#mobile-magazine-landing-nav__toggle');
mobileToggle.click(function () {
$('.news-navigation-bar__container').slideToggle(100, function () {
if ($(this).is(':visible')) {
$(this).css('display', 'flex');
}
});
if (mobileToggle.attr('aria-expanded') == 'false') {
mobileToggle.attr('aria-expanded', 'true');
mobileToggle.removeClass('soe-magazine__navigation-rotate-down');
mobileToggle.addClass('soe-magazine__navigation-rotate-up');
} else {
mobileToggle.attr('aria-expanded', 'false');
mobileToggle.removeClass('soe-magazine__navigation-rotate-up');
mobileToggle.addClass('soe-magazine__navigation-rotate-down');
}
})


function reorderElements() {
var windowWidth = $(window).width();
if (windowWidth < 768) {
// Reorder for mobile view (less than 768px)
$(".magazine-landing-nav__topics-panel").insertAfter(".topics_item");
} else {
// Reorder back for larger viewports
$(".magazine-landing-nav__topics-panel").insertAfter(".news-navigation-bar");
// Make sure we show the navigation bar if it was hidden.
$(".news-navigation-bar__container").show();
}
}

function fixNewsActivePath() {
let path = window.location.pathname;
// Check if the URL contains the substring '/news/'
if (path.indexOf('/news/') !== -1) {
$('a.su-multi-menu__link[href="/news"]').closest('li').addClass('su-multi-menu__item--active-trail');
}
}

// Run on document ready
reorderElements();
fixNewsActivePath();

// Run on window resize
$(window).resize(function() {
reorderElements();
});


}
};
Expand Down
Loading

0 comments on commit b375fb7

Please sign in to comment.