X-Git-Url: http://source.bookstackapp.com/bookstack/blobdiff_plain/8833b5bc3bc717c0303fb1a61a15c97f10b283ae..refs/pull/5280/head:/resources/sass/_header.scss diff --git a/resources/sass/_header.scss b/resources/sass/_header.scss index 246ef4b5b..d72b66729 100644 --- a/resources/sass/_header.scss +++ b/resources/sass/_header.scss @@ -2,12 +2,12 @@ * Includes the main navigation header and the faded toolbar. */ -header .grid { - grid-template-columns: auto min-content auto; +header.grid { + grid-template-columns: minmax(max-content, 2fr) 1fr minmax(max-content, 2fr); } @include smaller-than($l) { - header .grid { + header.grid { grid-template-columns: 1fr; grid-row-gap: 0; } @@ -21,10 +21,11 @@ header { color: rgb(250, 250, 250); border-bottom: 1px solid #DDD; box-shadow: $bs-card; - padding: $-xxs 0; @include lightDark(border-bottom-color, #DDD, #000); - @include whenDark { - filter: saturate(0.8) brightness(0.8); + .header-links { + display: flex; + align-items: center; + justify-content: end; } .links { display: inline-block; @@ -32,8 +33,13 @@ header { } .links a { display: inline-block; - padding: $-m; + padding: 10px $-m; color: #FFF; + border-radius: 3px; + } + .links a:hover { + text-decoration: none; + background-color: rgba(255, 255, 255, .15); } .dropdown-container { padding-inline-start: $-m; @@ -49,19 +55,25 @@ header { .user-name { vertical-align: top; position: relative; - display: inline-block; + display: inline-flex; + align-items: center; cursor: pointer; - > * { - vertical-align: top; - } + padding: $-s; + margin: 0 (-$-s); + border-radius: 3px; + gap: $-xs; > span { padding-inline-start: $-xs; display: inline-block; - padding-top: $-xxs; + line-height: 1; } > svg { - padding-top: 4px; font-size: 18px; + margin-top: -2px; + margin-inline-end: 0; + } + &:hover { + background-color: rgba(255, 255, 255, 0.15); } @include between($l, $xl) { padding-inline-start: $-xs; @@ -77,66 +89,112 @@ header { } -.header-search { - display: inline-block; -} header .search-box { display: inline-block; - margin-top: 10px; input { background-color: rgba(0, 0, 0, 0.2); border: 1px solid rgba(255, 255, 255, 0.2); border-radius: 40px; color: #EEE; z-index: 2; + height: auto; + padding: $-xs*1.5; padding-inline-start: 40px; &:focus { outline: none; - border: 1px solid rgba(255, 255, 255, 0.6); + border: 1px solid rgba(255, 255, 255, 0.4); } } - button { - z-index: 1; - left: 16px; - @include lightDark(color, rgba(255, 255, 255, 0.8), #AAA); - @include rtl { - left: auto; - right: 16px; - } - svg { - margin-block-end: 0; - } - } - ::-webkit-input-placeholder { /* Chrome/Opera/Safari */ - color: #DDD; - } - ::-moz-placeholder { /* Firefox 19+ */ - color: #DDD; + input::placeholder { + color: #FFF; + opacity: 0.6; } @include between($l, $xl) { max-width: 200px; } + &:focus-within #header-search-box-button { + opacity: 1; + } +} +#header-search-box-button { + z-index: 1; + inset-inline-start: 16px; + top: 10px; + color: #FFF; + opacity: 0.6; + @include lightDark(color, rgba(255, 255, 255, 0.8), #AAA); + svg { + margin-inline-end: 0; + } +} + +.global-search-suggestions { + display: none; + position: absolute; + top: -$-s; + left: 0; + right: 0; + z-index: -1; + margin-left: -$-xxl; + margin-right: -$-xxl; + padding-top: 56px; + border-radius: 3px; + box-shadow: $bs-hover; + transform-origin: top center; + opacity: .5; + transform: scale(0.9); + .entity-item-snippet p { + display: none; + } + .entity-item-snippet { + font-size: .8rem; + } + .entity-list-item-name { + font-size: .9rem; + display: -webkit-box; + -webkit-box-orient: vertical; + -webkit-line-clamp: 2; + overflow: hidden; + } + .global-search-loading { + position: absolute; + width: 100%; + } +} +header .search-box.search-active:focus-within { + .global-search-suggestions { + display: block; + } + input { + @include lightDark(background-color, #EEE, #333); + @include lightDark(border-color, #DDD, #111); + } + #header-search-box-button, input { + @include lightDark(color, #444, #AAA); + } } .logo { - display: inline-block; + display: inline-flex; + padding: ($-s - 6px) $-s; + margin: 6px (-$-s); + gap: $-s; + align-items: center; + border-radius: 4px; &:hover { color: #FFF; text-decoration: none; + background-color: rgba(255, 255, 255, .15); } } + .logo-text { - display: inline-block; font-size: 1.8em; color: #fff; font-weight: 400; - @include padding(14px, $-l, 14px, 0); - vertical-align: top; line-height: 1; } .logo-image { - @include margin($-xs, $-s, $-xs, 0); - vertical-align: top; height: 43px; } @@ -147,9 +205,6 @@ header .search-box { border: 2px solid rgba(255, 255, 255, 0.8); border-radius: 4px; padding: 0 $-xs; - position: absolute; - right: $-m; - top: 13px; line-height: 1; cursor: pointer; user-select: none; @@ -157,43 +212,49 @@ header .search-box { margin: 0; bottom: -2px; } - @include rtl() { - left: $-m; - right: auto; - } } - @include smaller-than($l) { header .header-links { @include lightDark(background-color, #fff, #333); display: none; z-index: 10; - right: $-m; + inset-inline-end: $-m; border-radius: 4px; overflow: hidden; position: absolute; box-shadow: $bs-hover; - margin-top: -$-xs; + margin-top: $-m; + padding: $-xs 0; &.show { display: block; } } header .links a, header .dropdown-container ul li a, header .dropdown-container ul li button { text-align: start; - display: block; - padding: $-s $-m; + display: grid; + align-items: center; + padding: 8px $-m; + gap: $-m; color: $text-dark; + grid-template-columns: 16px auto; + line-height: 1.4; @include lightDark(color, $text-dark, #eee); svg { margin-inline-end: $-s; + width: 16px; } &:hover { - @include lightDark(background-color, #eee, #333); - @include lightDark(color, #000, #fff); + background-color: var(--color-primary-light); + color: var(--color-primary); text-decoration: none; } + &:focus { + @include lightDark(background-color, #eee, #333); + outline-color: var(--color-primary); + color: var(--color-primary); + } } header .dropdown-container { display: block; @@ -219,17 +280,22 @@ header .search-box { z-index: 5; background-color: #FFF; border-bottom: 1px solid #DDD; + @include lightDark(border-bottom-color, #DDD, #333); box-shadow: $bs-card; } .tri-layout-mobile-tab { text-align: center; border-bottom: 3px solid #BBB; cursor: pointer; + margin: 0; + @include lightDark(background-color, #FFF, #222); + @include lightDark(border-bottom-color, #BBB, #333); &:first-child { border-inline-end: 1px solid #DDD; + @include lightDark(border-inline-end-color, #DDD, #000); } - &.active { - border-bottom-color: currentColor; + &[aria-selected="true"] { + border-bottom-color: currentColor !important; } } @@ -255,6 +321,9 @@ header .search-box { &:hover, &:focus-within { opacity: 1; } + @media (prefers-contrast: more) { + opacity: 1; + } } @include smaller-than($l) { @@ -269,21 +338,6 @@ header .search-box { } } -.dropdown-search { - position: relative; - .dropdown-search-toggle { - padding: 6px; - border: 1px solid transparent; - border-radius: 4px; - &:hover { - border-color: #DDD; - } - } - .svg-icon { - margin-inline-end: 0; - } -} - .faded { a, button, span, span > div { color: #666; @@ -302,43 +356,4 @@ header .search-box { .faded span.faded-text { display: inline-block; padding: $-s; -} - -.action-buttons .text-button { - display: inline-block; - padding: $-xs $-s; - &:last-child { - padding-inline-end: 0; - } - &:first-child { - padding-inline-start: 0; - } -} - - -.action-buttons .dropdown-container:last-child a { - padding-inline-end: 0; - padding-inline-start: $-s; -} -.action-buttons { - text-align: end; - &.text-left { - text-align: start; - .text-button { - padding-inline-end: $-m; - padding-inline-start: 0; - } - } - &.text-center { - text-align: center; - } -} - -@include smaller-than($m) { - .action-buttons .text-button { - padding: $-xs $-xs; - } - .action-buttons .dropdown-container:last-child a { - padding-inline-start: $-xs; - } } \ No newline at end of file