Visitar URL original
USWDS - Megamenu: Fix error with $theme-header-max-width: "none" by amyleadem · Pull Request #5072 · uswds/uswds · GitHub
Skip to content
Merged
Changes from 1 commit
Commits
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
Prev Previous commit
Next Next commit
Clean up outer-megamenu comments
  • Loading branch information
Amy Leadem
Amy Leadem committed Feb 1, 2023
commit 4e97c31f67a2bd89bc4b2a57f5c0bdfb81a20891
9 changes: 6 additions & 3 deletions packages/usa-header/src/styles/_usa-megamenu.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,18 @@
@use "sass:meta";
@use "uswds-core" as *;

// Calculate the width of the outer megamenu pseudo elements
@mixin outer-megamenu($header-max-width: $theme-header-max-width, $type) {
@include u-pin("y");
background-color: color("primary-darker");
content: "";
display: block;
position: absolute;

// Retrieve the unit value of $theme-header-max-width, depending on type of value added
// Set variabled for submenu max-width
$mw: smart-quote($header-max-width);
@if meta.type-of($header-max-width) == "string" {
// Retrieve the unit equivalent for header max width
$mw: units($header-max-width);
}

Expand All @@ -20,9 +22,10 @@
$mw: 100vw;
}

// subtract half the value of the viewport width from half the value of the submenu width
// standard needs the additional $theme-site-margins-width to accommodate different paddings/structure on #basic-mega-nav-section-two
// Calculate pseudo element width
// Subtract half the submenu width from half the viewport width
@if $type == "standard" {
// Add theme margin width to match padding in .usa-nav-container
width: calc(50vw - $mw / 2 + units($theme-site-margins-width));
} @else if $type == "extended" {
width: calc(50vw - $mw / 2);
Expand Down