digitransit-ui/app/component/navigation.scss
2025-05-07 11:23:24 +03:00

1042 lines
18 KiB
SCSS

@function navbar-icon-color($color) {
@if $nav-content-color {
// if defined in theme, return nav-content-color
@return $nav-content-color;
}
$background-color-brightness: (red($color) * 299) + (green($color) * 587) +
(blue($color) * 114) / 1000;
$light-color-lightness: round(
(red(#fff) * 299) + (green(#fff) * 587) + (blue(#fff) * 114) / 1000
);
@if abs($background-color-brightness) < ($light-color-lightness / 3) {
@return #ffffff;
} @else {
@return #333333;
}
}
/* foundation override */
$menu-slide: 'transform 200ms ease';
$offcanvas-background: #333;
$offcanvas-background-hover: scale-color($gray, $lightness: -30%);
$offcanvas-background-active: scale-color($gray, $lightness: -30%);
/* top bar */
$topbar-height: 40px;
$top-navigation-icon-color: navbar-icon-color($top-bar-color) !default;
$top-navigation-title-color: navbar-icon-color($top-bar-color);
/* offcanvas */
$offcanvas-profile-icon-size: 60px;
$offcanvas-profile-icon-color: $primary-color;
$offcanvas-lead-text-color: $gray;
$offcanvas-lead-text-font-family: $font-family;
$offcanvas-lead-text-font-weight: $font-weight-book;
$offcanvas-lead-text-letter-spacing: $letter-spacing;
$offcanvas-lead-text-font-size: 15px;
$offcanvas-login-text-font-family: $font-family;
$offcanvas-login-text-font-weight: $font-weight-book;
$offcanvas-login-text-letter-spacing: $letter-spacing;
$offcanvas-login-text-font-size: $font-size-small;
$offcanvas-login-arrow-icon-size: 14px;
$offcanvas-link-color: $primary-color;
$offcanvas-link-text-font-size: 15px;
/* Content */
$content-background-color: $background-color;
.top-bar {
height: 70px;
min-height: 70px;
position: relative;
display: flex;
align-items: center;
justify-content: space-between;
background: $top-bar-color;
text-align: center;
z-index: 1008;
// Fixed navbar height for now, as dynamic height leads to Safari issues
// height: $topbar-height;
// min-height: $topbar-height;
&.bp-large {
height: 60px;
align-items: center;
line-height: 1.8em;
@media print {
display: none;
}
}
.icon-holder {
margin: $padding-medium;
align-self: stretch;
}
.icon {
color: $top-navigation-icon-color;
vertical-align: middle;
}
section.title {
padding-left: $padding-medium;
display: flex;
align-items: center;
align-self: stretch;
text-align: center;
color: $top-navigation-title-color;
}
.logo {
height: $nav-logo-height;
min-height: $nav-logo-min-height;
min-width: 13em;
background-size: contain;
background-repeat: no-repeat;
background-position: left center;
}
.controls {
display: flex;
}
}
.mobile.top-bar {
height: 50px;
min-height: 50px;
z-index: 1000;
background: $top-bar-color;
.logo {
min-height: 30px;
max-height: 40px;
}
}
#skip-to-content-link {
height: 0;
@media print {
display: none;
}
}
.flex-horizontal {
display: flex;
flex-direction: row;
}
#lang-select {
margin-top: 45px;
padding-bottom: 10px;
.lang {
text-decoration: none;
line-height: normal;
color: $primary-color;
@include font-medium;
font-size: $font-size-large;
display: inline-block;
text-transform: uppercase;
cursor: pointer;
padding: 8px 13px;
margin: 0 2px;
&.selected {
color: $white;
background-color: #333;
}
}
}
.navi-languages {
// desktop
#lang-select {
border-bottom: 0;
.lang.selected {
background: $selected-lang-background;
}
}
}
.right-border {
border-right: 1px solid rgba(0, 0, 0, 0.15);
}
.login-button-container {
width: 100%;
> button {
display: flex;
align-items: center;
height: 100%;
margin-right: 0.7rem;
}
.icon {
font-size: 2em;
color: $top-navigation-icon-color;
&.caution-topbar {
fill: $caution-icon-color;
color: $caution-icon-font-color;
}
}
}
.usermenu-wrapper {
user-select: none;
display: flex;
position: relative;
flex-direction: column;
}
.usermenu-header {
display: flex;
flex-direction: row;
z-index: 1;
padding: 0.625rem 0;
cursor: pointer;
align-items: center;
text-align: center;
line-height: normal;
}
.usermenu-title {
display: flex;
flex-direction: row;
}
.usermenu-title-text {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
margin-right: 0.625rem;
padding-left: 0.5rem;
color: $top-navigation-icon-color;
max-width: 4.5rem;
font-size: 1rem;
@include min-width(tablet) {
font-size: $font-size-normal;
}
}
.usermenu-container {
z-index: 0;
opacity: 0;
position: absolute;
min-width: 200px;
background-color: $primary-color;
transition: opacity 0.1s linear;
&.open {
border-top: 1px solid rgba(0, 0, 0, 0.2);
border-bottom-left-radius: 8px;
border-bottom-right-radius: 8px;
box-shadow: none;
top: 50px;
right: -25px;
opacity: 1;
@include min-width(tablet) {
right: 0;
top: 61px;
}
}
}
.usermenu-list {
list-style-type: none;
padding: 10px 0 15px;
margin: 0;
.usermenu-list-item {
flex-direction: row;
justify-content: flex-start;
display: flex;
width: 100%;
line-height: normal;
font-weight: $font-weight-medium;
border-top: 1px solid transparent;
font-size: $font-size-normal;
> a {
position: relative;
display: block;
width: 100%;
text-decoration: none;
color: $top-navigation-icon-color;
line-height: 2.4;
letter-spacing: -0.6px;
text-align: start;
margin: 0 15px;
}
}
.usermenu-list-item:not(:last-child) > a {
border-bottom: 1px solid rgba(0, 0, 0, 0.2);
@include min-width(tablet) {
border-bottom: none;
}
}
.usermenu-list-item:hover {
background: darken($primary-color, 5%);
}
}
.navi-icons {
.icon {
font-size: 1.8em;
color: $primary-color;
fill: $top-navigation-icon-color;
&.caution-topbar {
fill: $caution-icon-color;
color: $caution-icon-font-color;
}
}
width: 50px;
}
.main-menu-toggle {
.icon {
font-size: 1.75em;
}
align-items: center;
display: flex;
right: 0;
}
.back-button {
button {
font-size: 15px;
position: absolute;
left: -2px;
top: 4px;
.icon {
height: 1.3em;
width: 1.3em;
}
}
h1 {
font-size: 1.2em;
margin: 0 0 0 2.5em;
font-weight: $font-weight-medium;
font-family: $heading-font-family;
&::first-letter {
text-transform: capitalize;
}
}
}
.select-from-map-nav-container {
display: flex;
align-items: center;
height: 55px;
background-color: #fff;
}
.select-from-map-nav-title {
flex-grow: 1;
font-size: 18px;
font-weight: $font-weight-medium;
font-stretch: normal;
font-style: normal;
line-height: normal;
letter-spacing: -0.6;
text-align: center;
vertical-align: text-top;
color: #333;
position: relative;
white-space: nowrap;
}
.select-from-map-confirm-button-container {
display: flex;
width: 100%;
justify-content: center;
align-items: center;
align-self: center;
}
.main-menu {
outline: none;
width: 400px;
padding: 0;
padding-left: 20px;
padding-right: 20px;
background: $white;
color: $offcanvas-link-color;
height: 100%;
overflow-y: auto;
text-align: left;
@include font-medium;
i.icon-profile {
font-size: $offcanvas-profile-icon-size;
color: $offcanvas-profile-icon-color;
}
a {
color: $offcanvas-link-color;
text-decoration: none;
}
label {
color: $offcanvas-link-color;
text-decoration: none;
font-weight: inherit;
font-size: inherit;
line-height: inherit;
display: flex;
justify-content: space-between;
.option-toggle-container {
display: flex;
align-self: center;
}
}
span {
cursor: pointer;
color: $offcanvas-link-color;
text-decoration: none;
}
.icon {
fill: $offcanvas-link-color;
&.small {
width: 10px;
height: 10px;
}
&.medium {
width: 16px;
height: 16px;
}
}
.close-button {
padding: 15px 0;
float: right;
background: none;
}
button.noborder {
@include font-medium;
font-family: $button-font-family;
}
.menu-section {
border-bottom: 1px solid #ddd;
padding-bottom: 15px;
padding-top: 15px;
&.main-links {
.offcanvas-section {
font-family: $heading-font-family;
button {
font-weight: $font-weight-medium;
}
}
font-weight: $font-weight-medium !important;
}
&.secondary-links .offcanvas-section button {
font-weight: $font-weight-book;
}
}
.menu-section:last-of-type {
.menu-item {
font-weight: $font-weight-book;
}
}
.copyright {
font-family: $heading-font-family;
font-weight: $font-weight-book;
color: black;
margin-top: 30px;
}
.main-menu-top-section {
display: flex;
float: right;
margin-top: 1em;
.noborder {
margin-right: 10px;
}
}
}
.menu-background {
position: fixed;
height: 100%;
width: 100%;
top: 0;
left: 0;
opacity: 0;
z-index: 1200;
transition:
left 0ms cubic-bezier(0.23, 1, 0.32, 1) 0ms,
opacity 400ms cubic-bezier(0.23, 1, 0.32, 1) 0ms;
}
.menu-background-close {
opacity: 0 !important;
}
.menu-background-open {
opacity: 1;
}
.menu-content {
background-color: #333;
position: fixed;
left: auto;
right: 0;
height: 100%;
z-index: 1300;
box-shadow:
rgba(0, 0, 0, 0.16) 0 3px 10px,
rgba(0, 0, 0, 0.23) 0 3px 10px;
transition: transform 450ms cubic-bezier(0.23, 1, 0.32, 1);
transform: translate(100%, 0);
}
.menu-content-close {
transform: translate(100%, 0) !important;
}
.menu-content-open {
transform: translate(0, 0);
}
.mobile {
.main-menu {
width: 100%;
}
.menu-content {
width: 100%;
}
}
.offcanvas-section {
line-height: 35px;
padding: 0.5em 0;
.menu-item {
margin: 0;
display: inline-block;
font-size: $font-size-normal;
font-family: $heading-font-family;
button {
font-family: $button-font-family;
font-size: $font-size-normal;
}
.icon {
display: none;
}
}
.disruption-info {
height: 35px;
align-items: center;
.icon.disruption-info {
font-family: $heading-font-family;
padding-left: 0;
margin-left: 10px;
width: 24px;
fill: #dc0451;
height: 21px;
}
}
}
section.content {
background-color: $content-background-color;
position: relative;
display: flex;
flex-direction: column;
flex: 0 1 100%;
.mobile {
display: flex;
flex-direction: column;
height: 100%;
position: relative;
.back-button {
left: 0;
}
}
.desktop {
display: flex;
flex-direction: row;
height: 100%;
@media print {
display: block;
}
.desktop-title {
background: #fff;
&-bordered {
&::after {
content: '';
display: block;
position: absolute;
bottom: 0;
left: 0;
right: 0;
height: 1px;
background-color: $light-gray;
}
}
a {
color: $desktop-title-arrow-icon-color;
}
.title-container {
@include font-medium;
color: #333;
margin: 50px 0 16px 0;
line-height: 1;
.back-button {
position: static;
button {
left: 0.5em;
top: auto;
}
}
}
h1 {
@include font-medium;
font-family: $heading-font-family;
color: #333;
display: inline;
}
.home-icon {
font-size: 0.8em;
}
.arrow-icon {
margin: 2px 1em;
color: $desktop-title-arrow-icon-color;
}
}
.back-button {
position: absolute;
left: 24px;
}
.main-content {
width: 520px;
height: 100%;
display: flex;
flex-direction: column;
@media print {
height: auto;
width: 100%;
display: inline;
}
.scrollable-content-wrapper {
display: flex;
flex-basis: 0;
flex-direction: column;
flex-grow: 1;
flex-shrink: 0;
@media print {
display: inline;
height: auto;
width: 100%;
}
}
}
.map-content {
width: calc(100% - 520px);
height: 100%;
display: flex;
position: relative;
@media print {
page-break-before: always;
width: 100%;
min-height: 27cm;
}
}
}
}
@media print {
section.content {
height: auto;
display: block;
.desktop {
height: auto;
display: block;
}
}
}
.content.bp-large {
height: calc(100% - 100px);
position: relative;
}
.content:nth-child(5) {
height: calc(100% - #{$topbar-height} - 100px - 18px);
// 100px and 18px are the height of the message bar, but is specified in js
}
.mobile-main-container {
display: flex;
flex-direction: column;
flex-grow: 1;
}
.mobile-main-content-container {
flex-grow: 1;
}
.mobile-footer {
border-top: 1px solid #ddd;
}
.mobile-footer div:nth-of-type(1) {
position: relative;
bottom: 0;
display: flex;
justify-content: space-between;
color: #333;
font-weight: 325;
align-items: center;
text-align: right;
}
.mobile-footer-bar-container {
display: flex;
justify-content: center;
}
.mobile-footer .cookie-settings-button-mobile {
color: $primary-color;
letter-spacing: -0.3px;
}
.mobile-footer-bar {
background-color: #020202;
height: 5px;
width: 139px;
border-radius: 5px;
margin-bottom: 5px;
}
.message-bar {
@media print {
display: none;
}
@keyframes fadein {
from {
opacity: 0;
}
to {
opacity: 1;
}
}
animation: fadein 1s;
position: relative;
z-index: 802;
width: 100%;
display: block;
@include font-book;
font-size: 15px;
line-height: 21px;
letter-spacing: -0.42px;
color: $black;
text-align: left;
cursor: pointer;
.banner-container {
height: auto;
display: flex;
overflow: hidden;
.message-bar-content {
flex-basis: auto;
flex-grow: 1;
width: 60%;
}
.message-bar-container {
overflow: hidden;
padding: 10px 10px 0 10px;
.single-alert {
margin-bottom: 15px;
.message-content {
.message-heading {
min-height: 11px;
}
button {
text-decoration: underline;
font-weight: $font-weight-bold;
font-family: $font-family;
}
.message-bar-link {
word-break: normal;
color: $primary-color;
}
}
}
.react-swipe-container {
height: auto;
width: 100%;
margin-bottom: 0;
@media print {
display: block;
height: auto;
}
.message-content {
.message-heading {
min-height: 11px;
}
button {
text-decoration: underline;
font-weight: $font-weight-bold;
}
.message-bar-link {
word-break: normal;
color: $primary-color;
}
}
}
.swipe-header {
justify-content: center;
}
.swipe-tab-indicator {
flex-grow: 0;
}
.swipe-button .icon {
height: 14px;
width: 14px;
&.disabled {
fill: $medium-gray;
}
}
}
&.banner-disruption {
background: $banner-disruption-color;
.swipe-tab-ball {
&.selected {
border: solid 2px $white;
background-color: $white;
}
}
.icon {
color: $disruption-color;
fill: white;
}
#close-message-bar {
display: inline-block;
.icon {
fill: white !important;
}
}
.message-bar-content,
a,
h2 {
color: white;
}
.message-bar-container {
.react-swipe-container,
.single-alert {
.message-content {
white-space: pre-wrap;
.message-bar-link {
color: $white;
}
}
}
}
}
}
.message-bar-container {
max-height: 100%;
.react-swipe-container {
height: auto;
width: 105%; // Hides the currently not visible swipe content
margin-bottom: 5px;
.message-content {
a {
font-weight: $font-weight-bold;
color: $white;
}
}
}
&.message-bar-disruption {
a {
color: white;
}
}
}
h2 {
font-size: 15px;
letter-spacing: -0.42px;
margin-top: 12px;
line-height: 15px;
margin-bottom: 6px;
}
.message-bar-error {
h2 {
color: red;
}
}
a {
@include font-medium;
padding: 0 4px;
}
svg.message-bar-link-icon {
margin: 0 0 0 $padding-small;
position: relative;
top: 0.125em;
}
}
#close-message-bar {
span {
margin: -3px -5px 0 0;
}
}
// Need more specific selector to override
.message-bar .icon {
margin: 17px;
}
.message-bar .icon.message-icon {
float: left;
fill: $primary-color;
height: 24px;
width: 24px;
margin: 18px;
}
.message-bar .icon.close {
float: right;
fill: $gray;
height: 12px;
width: 12px;
}
.external-top-bar {
.external-link-icon-outer {
color: $primary-color;
}
.external-link-icon {
color: $primary-font-color;
}
}
.external-link-decoration {
position: absolute;
top: -1px;
right: -1px;
font-size: 7px;
}
.external-link-container {
position: relative;
display: inline-block;
line-height: 22px;
font-size: 18px;
margin: 0;
padding: 0 6px;
border: 1px solid rgba(0, 0, 0, 0.15);
border-radius: 4px;
a.external-link {
display: inline-block;
vertical-align: text-top;
color: $white;
font-size: $font-size-xxsmall;
text-decoration: none;
}
}