Visitar URL original
Merge pull request #5072 from uswds/al-fix-header-max-width · uswds/uswds@53ded2f · GitHub
Skip to content

Commit 53ded2f

Browse files
authored
Merge pull request #5072 from uswds/al-fix-header-max-width
USWDS - Megamenu: Fix error with $theme-header-max-width: "none"
2 parents 59b5e1b + afda7db commit 53ded2f

2 files changed

Lines changed: 12 additions & 3 deletions

File tree

‎packages/usa-header/src/styles/_usa-megamenu.scss‎

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,30 @@
22
@use "sass:meta";
33
@use "uswds-core" as *;
44

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

12-
// retrieve the unit value of $theme-header-max-width, depending on type of value added
13+
// Set variable for submenu max width
1314
$mw: smart-quote($header-max-width);
1415
@if meta.type-of($header-max-width) == "string" {
16+
// Retrieve the unit equivalent for submenu max width
1517
$mw: units($header-max-width);
1618
}
1719

18-
// subtract half the value of the viewport width from half the value of the submenu width
19-
// standard needs the additional $theme-site-margins-width to accommodate different paddings/structure on #basic-mega-nav-section-two
20+
// Create the vw equivalent for max-width:none
21+
@if $header-max-width == "none" {
22+
$mw: 100vw;
23+
}
24+
25+
// Calculate pseudo element width
26+
// Subtract half the submenu width from half the viewport width
2027
@if $type == "standard" {
28+
// Add theme margin width to match padding in .usa-nav-container
2129
width: calc(50vw - $mw / 2 + units($theme-site-margins-width));
2230
} @else if $type == "extended" {
2331
width: calc(50vw - $mw / 2);

‎packages/uswds-core/src/styles/tokens/units/spacing.scss‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,5 +101,6 @@ $system-spacing: (
101101
"special": (
102102
0: 0,
103103
"auto": auto,
104+
"none": none,
104105
),
105106
);

0 commit comments

Comments
 (0)