Files
Megamenu/src/extensions/megaMenu/MegaMenu.module.scss
T

533 lines
13 KiB
SCSS

@import '~@microsoft/sp-office-ui-fabric-core/dist/sass/SPFabricCore.scss';
$white: "[theme: white, default: #ffffff]";
$neutralLighter: "[theme: neutralLighter, default: #f4f4f4]";
$neutralLight: "[theme: neutralLight, default: #eaeaea]";
$neutralTertiary: "[theme: neutralTertiary, default: #a6a6a6]";
$neutralSecondary: "[theme: neutralSecondary, default: #666666]";
$neutralPrimary: "[theme: neutralPrimary, default: #333333]";
$themePrimary: "[theme: themePrimary, default: #0078d7]";
$themeDark: "[theme: themeDark, default: #005a9e]";
$themeLighterAlt: "[theme: themeLighterAlt, default: #eff6fc]";
$menuShadow: 0 8px 24px rgba(0, 0, 0, 0.16);
$menuLayer: var(--megaMenuZIndex, 6000);
:global {
:root {
--megaMenuBarHeight: 44px;
--megaMenuContentWidth: 1200px;
--megaMenuFlyoutWidth: 288px;
--megaMenuZIndex: 9.5;
}
#CustomNavigation {
position: relative;
box-sizing: border-box;
width: 100%;
overflow: visible;
border-top: 1px solid #edebe9;
border-bottom: 1px solid #edebe9;
z-index: $menuLayer;
font-family: 'Segoe UI', 'Segoe UI Web (West European)', -apple-system, BlinkMacSystemFont, Roboto, 'Helvetica Neue', sans-serif;
}
.mega-menu-status {
box-sizing: border-box;
padding: 10px 24px;
border-bottom: 1px solid $neutralLight;
background: $themeLighterAlt;
color: $neutralPrimary;
font-size: 13px;
}
.mega-menu-main {
position: relative;
box-sizing: border-box;
width: 100%;
min-height: var(--megaMenuBarHeight, 44px);
overflow: visible;
border-top: 0;
border-bottom: 0;
background: $white;
color: $neutralPrimary;
z-index: $menuLayer;
}
.mega-menu-top-level {
display: flex;
align-items: stretch;
box-sizing: border-box;
width: 100%;
max-width: var(--megaMenuContentWidth, 1200px);
min-height: var(--megaMenuBarHeight, 44px);
margin: 0 auto;
padding: 0 24px;
list-style: none;
}
.mega-menu-top-item {
position: static;
display: flex;
align-items: stretch;
margin: 0;
padding: 0;
}
.mega-menu-top-item:hover,
.mega-menu-top-item:focus-within,
.mega-menu-top-item:active,
.mega-menu-top-item.is-open,
.mega-menu-top-item.is-active {
background: $neutralLighter;
color: $neutralPrimary;
}
.mega-menu-mobile-toggle {
display: none;
}
.mega-menu-mode-flyout .mega-menu-top-item {
position: relative;
}
.menu-item-link,
.menu-item-text {
position: relative;
display: flex;
align-items: center;
box-sizing: border-box;
min-height: var(--megaMenuBarHeight, 44px);
padding: 0 16px;
border: 0;
background: transparent;
color: $neutralPrimary;
cursor: pointer;
font-size: 14px;
font-weight: 400;
line-height: 20px;
text-decoration: none;
white-space: nowrap;
outline: none;
}
.menu-item-toggle {
position: relative;
display: flex;
align-items: center;
justify-content: center;
box-sizing: border-box;
width: 32px;
min-height: var(--megaMenuBarHeight, 44px);
margin: 0 8px 0 -10px;
padding: 0;
border: 0;
background: transparent;
color: $neutralPrimary;
cursor: pointer;
}
.menu-item-toggle > span::after {
content: '';
display: block;
width: 6px;
height: 6px;
border-right: 1px solid currentColor;
border-bottom: 1px solid currentColor;
transform: rotate(45deg);
}
.menu-item-toggle[aria-expanded='true'] > span::after {
transform: rotate(225deg);
}
.menu-item-link:hover,
.menu-item-text:hover,
.menu-item-toggle:hover,
.menu-item-toggle[aria-expanded='true'] {
background: transparent;
color: inherit;
text-decoration: none;
}
.mega-menu-top-item.is-active > .menu-item-link::before,
.mega-menu-top-item.is-active > .menu-item-text::before,
.mega-menu-top-item.is-current > .menu-item-link::before,
.mega-menu-top-item.is-current > .menu-item-text::before {
content: '';
position: absolute;
right: 12px;
bottom: 0;
left: 12px;
height: 2px;
background: $themePrimary;
}
.mega-menu-top-item.is-current > .menu-item-link,
.mega-menu-top-item.is-current > .menu-item-text {
color: $themeDark;
font-weight: 600;
}
.menu-item-link:focus,
.menu-item-text:focus,
.menu-item-toggle:focus,
.mega-menu-mobile-toggle:focus,
.mega-menu-category a:focus,
.flyout-link:focus {
outline: 2px solid $themePrimary;
outline-offset: -2px;
}
.mega-menu {
position: absolute;
top: 100%;
left: 0;
right: 0;
display: none;
box-sizing: border-box;
visibility: hidden;
opacity: 0;
border: 1px solid #edebe9;
border-top: 0;
background: $white;
box-shadow: $menuShadow;
color: $neutralPrimary;
z-index: calc(#{$menuLayer} + 1);
}
.mega-menu.js-open {
display: block;
visibility: visible;
opacity: 1;
}
.mega-menu-grid {
display: grid;
grid-template-columns: repeat(var(--megaMenuColumnCount, 6), minmax(0, 1fr));
box-sizing: border-box;
width: 100%;
max-width: var(--megaMenuContentWidth, 1200px);
margin: 0;
padding: 24px;
gap: 24px 32px;
background: $white;
}
.mega-menu-category {
min-width: 0;
padding: 0 0 8px;
}
.mega-menu-description {
margin: -4px 0 12px;
color: $neutralSecondary;
font-size: 12px;
line-height: 18px;
}
.mega-menu-category-title {
margin: 0 0 10px;
padding: 0 0 8px;
border-bottom: 1px solid $neutralLight;
}
.mega-menu-category-title > a,
.mega-menu-category-title > span {
display: block;
color: $neutralPrimary;
font-size: 14px;
font-weight: 600;
line-height: 20px;
text-decoration: none;
}
.mega-menu-category-title > a:hover {
color: $themePrimary;
text-decoration: underline;
}
.mega-menu-links {
margin: 0;
padding: 0;
list-style: none;
}
.mega-menu-links li {
margin: 0;
padding: 0;
}
.mega-menu-links a {
display: block;
margin: 0 -8px;
padding: 6px 8px;
border-radius: 2px;
color: $neutralSecondary;
font-size: 14px;
line-height: 20px;
text-decoration: none;
}
.mega-menu-links a:hover {
background: $neutralLighter;
color: $neutralPrimary;
text-decoration: none;
}
.mega-menu-links a.is-current,
.mega-menu-links li.is-current > a {
color: $themeDark;
font-weight: 600;
}
.mega-menu-flyout {
right: auto;
width: var(--megaMenuFlyoutWidth, 288px);
min-width: 240px;
border-top: 1px solid $neutralLight;
}
.flyout-list {
box-sizing: border-box;
width: 100%;
margin: 0;
padding: 8px 0;
background: $white;
list-style: none;
}
.flyout-item {
position: relative;
margin: 0;
padding: 0;
}
.flyout-link {
position: relative;
display: flex;
align-items: center;
justify-content: space-between;
box-sizing: border-box;
width: 100%;
min-height: 36px;
padding: 8px 36px 8px 16px;
border: 0;
background: $white;
color: $neutralPrimary;
cursor: pointer;
font-size: 14px;
line-height: 20px;
text-decoration: none;
outline: none;
}
.flyout-item:hover > .flyout-link,
.flyout-item:focus-within > .flyout-link,
.flyout-item:active > .flyout-link,
.flyout-item.is-active > .flyout-link {
background: $neutralLighter;
color: $neutralPrimary;
text-decoration: none;
}
.flyout-item.is-current > .flyout-link {
color: $themeDark;
font-weight: 600;
}
.flyout-toggle {
position: absolute;
top: 0;
right: 0;
display: flex;
align-items: center;
justify-content: center;
width: 36px;
height: 36px;
padding: 0;
border: 0;
background: transparent;
color: $neutralPrimary;
cursor: pointer;
}
.flyout-toggle > span::after {
content: '';
display: block;
width: 6px;
height: 6px;
border-top: 1px solid currentColor;
border-right: 1px solid currentColor;
transform: rotate(45deg);
}
.flyout-toggle:focus {
outline: 2px solid $themePrimary;
outline-offset: -2px;
}
.flyout-level-3 {
position: absolute;
top: -9px;
left: 100%;
display: none;
width: var(--megaMenuFlyoutWidth, 288px);
border: 1px solid $neutralLight;
box-shadow: $menuShadow;
z-index: calc(#{$menuLayer} + 2);
}
.flyout-item:hover > .flyout-level-3,
.flyout-item:focus-within > .flyout-level-3,
.flyout-item.is-open > .flyout-level-3 {
display: block;
}
.sr-only {
position: absolute;
width: 1px;
height: 1px;
padding: 0;
margin: -1px;
overflow: hidden;
clip: rect(0, 0, 0, 0);
white-space: nowrap;
border: 0;
}
@media (max-width: 1024px) {
.mega-menu-top-level {
padding: 0 12px;
}
.mega-menu-grid {
grid-template-columns: repeat(2, minmax(0, 1fr));
padding: 20px;
}
}
@media (max-width: 767px) {
.mega-menu-mobile-toggle {
display: flex;
align-items: center;
width: 100%;
min-height: var(--megaMenuBarHeight, 44px);
padding: 0 16px;
border: 0;
background: $white;
color: $neutralPrimary;
cursor: pointer;
font: inherit;
font-weight: 600;
}
.mega-menu-mobile-icon,
.mega-menu-mobile-icon::before,
.mega-menu-mobile-icon::after {
display: block;
width: 18px;
height: 2px;
background: currentColor;
}
.mega-menu-mobile-icon {
position: relative;
margin-right: 12px;
}
.mega-menu-mobile-icon::before,
.mega-menu-mobile-icon::after {
content: '';
position: absolute;
left: 0;
}
.mega-menu-mobile-icon::before { top: -6px; }
.mega-menu-mobile-icon::after { top: 6px; }
.mega-menu-top-level {
display: none;
flex-direction: column;
padding: 0;
border-top: 1px solid $neutralLight;
}
.mega-menu-main.is-mobile-open .mega-menu-top-level {
display: flex;
}
.mega-menu-top-item,
.mega-menu-mode-flyout .mega-menu-top-item {
position: relative;
display: grid;
grid-template-columns: minmax(0, 1fr) 44px;
border-bottom: 1px solid $neutralLight;
}
.menu-item-link,
.menu-item-text {
min-height: 40px;
padding: 0 12px;
font-size: 13px;
}
.menu-item-toggle {
width: 44px;
margin: 0;
border-left: 0;
}
.mega-menu {
position: static;
grid-column: 1 / -1;
width: 100%;
border-right: 0;
border-left: 0;
box-shadow: none;
}
.mega-menu-grid {
grid-template-columns: 1fr;
padding: 16px;
}
.mega-menu-mode-flyout .mega-menu-flyout {
position: fixed;
right: 8px;
left: 8px;
width: auto;
}
.flyout-level-3 {
position: static;
display: none;
width: 100%;
border: 0;
box-shadow: none;
padding: 0 0 4px 16px;
}
.flyout-item.is-open > .flyout-level-3 {
display: block;
}
}
@media (prefers-reduced-motion: reduce) {
.mega-menu,
.menu-item-link,
.menu-item-text,
.flyout-link {
transition: none;
}
}
@media (forced-colors: active) {
.menu-item-link:focus,
.menu-item-text:focus,
.mega-menu-category a:focus,
.flyout-link:focus {
outline: 2px solid CanvasText;
}
}
}