From 71952c9b0aa5bca036af11c2d058dd76a763e21a Mon Sep 17 00:00:00 2001 From: Kelvin Oghenerhoro Omereshone Date: Wed, 10 Aug 2022 04:23:14 +0100 Subject: [PATCH] Make top banner not sticky (#6797) * feat: Make top banner not sticky * fix: issue with transition on page load and scroll * fix: add semi colon to less to resolve linting issues * fix: commas issue in less * fix: space between header and cta-banner * fix: resolve scrolling weird animation and hero section jumps * fix: responseive top value set * feat: don't animate background color * feat: add transition for the top property of the header * update sticky header function and styles Co-authored-by: Eric --- website/assets/styles/layout.less | 87 ++++++++++++++++++++----------- website/views/layouts/layout.ejs | 22 +++++--- 2 files changed, 71 insertions(+), 38 deletions(-) diff --git a/website/assets/styles/layout.less b/website/assets/styles/layout.less index ee4a20d07d..19d73764e7 100644 --- a/website/assets/styles/layout.less +++ b/website/assets/styles/layout.less @@ -15,10 +15,41 @@ html, body { position: relative; padding-bottom: @footer-height; } +.homepage-cta-banner { + background-color: #FFF; + color: #000; + + a { + color: #000; + } +} +// Apply this margin when there is a CTA banner on the homepage +.homepage-cta-banner + .homepage-header-top { + top: 52px; +} +.non-homepage-cta-banner { + background-color: @core-fleet-black; + color: #FFF; + a { + color: #FFF; + } +} +[purpose='header-report-cta'] { + p { + font-size: 14px; + line-height: 20px; + } + a { + font-size: 14px; + line-height: 20px; + font-weight: 700; + text-decoration: underline; + } +} [purpose='page-header'] { // rules for sticky nav transitions - transition-property: all; + transition-property: background-color, transform, bottom; transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); transition-duration: 500ms; @@ -106,28 +137,18 @@ html, body { } } } - [purpose='header-report-cta'] { - p { - font-size: 14px; - line-height: 20px; - } - a { - font-size: 14px; - line-height: 20px; - font-weight: 700; - text-decoration: underline; - } - } } // Homepage header styles &.homepage-header { z-index: 9999; - position: fixed; - color: #ffffff; + position: absolute; + color: #fff; top: 0; left: 0; right: 0; &.sticky { + position: fixed; background-color: #fff; + border-color: transparent; color: #192147; .btn.btn-link { @@ -154,14 +175,6 @@ html, body { cursor: pointer; } } - [purpose='header-report-cta'] { - background-color: #FFF; - color: #000; - - a { - color: #000; - } - } } // Non-homepage header styles &.header { left: 0; @@ -193,13 +206,6 @@ html, body { cursor: pointer; } } - [purpose='header-report-cta'] { - background-color: @core-fleet-black; - color: #FFF; - a { - color: #FFF; - } - } } // Footer styles @@ -254,6 +260,11 @@ body.detected-mobile { // devices (like the iPad) as well as handset devices (like the iPhone). // … } +@media (max-width: 992px) { + .homepage-cta-banner+.homepage-header-top { + top: 72px; + } +} @media (max-width: 767px) { [purpose='page-wrap'] { @@ -264,7 +275,11 @@ body.detected-mobile { } } } - +@media (max-width: 605px) { + .homepage-cta-banner + .homepage-header-top { + top: 92px; + } +} @media (max-width: 575px) { [purpose='page-wrap'] { padding-bottom: 371px; @@ -296,6 +311,16 @@ body.detected-mobile { } } } +@media (max-width: 393px) { + .homepage-cta-banner + .homepage-header-top { + top: 112px; + } +} +@media (max-width: 330px) { + .homepage-cta-banner + .homepage-header-top { + top: 132px; + } +} // Some utilities for the sticky nav behaviour .translate-y-0 { diff --git a/website/views/layouts/layout.ejs b/website/views/layouts/layout.ejs index 94912d86d7..c3b50a23f3 100644 --- a/website/views/layouts/layout.ejs +++ b/website/views/layouts/layout.ejs @@ -111,14 +111,14 @@ -
-
-
+
+

We surveyed 200+ security practitioners to discover the state of device management in 2022.

Click here to learn about their struggles and best practices.
-
+
+
<% /* The homepage-header on the homepage has a white fleet logo */ %> @@ -360,13 +360,18 @@