From 8fd8652bbfd66f522869462c69e35bfbfbec770d Mon Sep 17 00:00:00 2001 From: Dan Brown Date: Sun, 9 Dec 2018 13:42:35 +0000 Subject: [PATCH] Added tri-layout desktop sticky-scroll --- resources/assets/js/components/tri-layout.js | 8 ++++-- resources/assets/sass/_grid.scss | 29 ++++++++++++++++---- resources/views/tri-layout.blade.php | 8 ++++-- 3 files changed, 35 insertions(+), 10 deletions(-) diff --git a/resources/assets/js/components/tri-layout.js b/resources/assets/js/components/tri-layout.js index cb6e02fcc..d18d37d60 100644 --- a/resources/assets/js/components/tri-layout.js +++ b/resources/assets/js/components/tri-layout.js @@ -18,7 +18,9 @@ class TriLayout { } updateLayout() { - const newLayout = (window.innerWidth <= 1000) ? 'mobile' : 'desktop'; + let newLayout = 'tablet'; + if (window.innerWidth <= 1000) newLayout = 'mobile'; + if (window.innerWidth >= 1400) newLayout = 'desktop'; if (newLayout === this.lastLayoutType) return; if (this.onDestroy) { @@ -28,7 +30,7 @@ class TriLayout { if (newLayout === 'desktop') { this.setupDesktop(); - } else { + } else if (newLayout === 'mobile') { this.setupMobile(); } @@ -50,7 +52,7 @@ class TriLayout { } setupDesktop() { - // TODO + // } /** diff --git a/resources/assets/sass/_grid.scss b/resources/assets/sass/_grid.scss index 8917889d4..9411db17b 100644 --- a/resources/assets/sass/_grid.scss +++ b/resources/assets/sass/_grid.scss @@ -55,9 +55,10 @@ body.flexbox { display: grid; grid-template-columns: 1fr minmax(auto, 940px) 1fr; grid-template-areas: "a b c"; - grid-column-gap: $-xl; - padding-right: $-xl; - padding-left: $-xl; + .tri-layout-right-contents, .tri-layout-left-contents { + padding-right: $-xl; + padding-left: $-xl; + } .tri-layout-right { grid-area: c; } @@ -85,18 +86,36 @@ body.flexbox { "a b b"; grid-template-columns: 1fr 3fr; grid-template-rows: max-content min-content; + padding-right: $-l; .content-wrap.card { padding: $-l $-l; } } } +@include larger-than($xxl) { + .tri-layout-left-contents, .tri-layout-right-contents { + position: sticky; + top: $-m; + max-height: 100vh; + overflow-y: scroll; + overflow-x: visible; + scrollbar-width: none; + -ms-overflow-style: none; + &::-webkit-scrollbar { + display: none; + } + } +} + @include smaller-than($l) { .tri-layout-container { grid-template-areas: none; grid-template-columns: 10% 90%; grid-column-gap: 0; - padding-right: $-l; - padding-left: $-l; + .tri-layout-left-contents, .tri-layout-right-contents { + padding-left: $-m; + padding-right: $-m; + } .tri-layout-right, .tri-layout-left { opacity: 0.6; z-index: 0; diff --git a/resources/views/tri-layout.blade.php b/resources/views/tri-layout.blade.php index 4b169b5c7..33ba6f616 100644 --- a/resources/views/tri-layout.blade.php +++ b/resources/views/tri-layout.blade.php @@ -11,7 +11,9 @@
@@ -19,7 +21,9 @@