From 002bddda521c38fe8f179104076ef103a761a1ac Mon Sep 17 00:00:00 2001 From: Florian Dieminger Date: Mon, 9 Oct 2023 20:57:24 +0200 Subject: [PATCH] fix(blog): move toc to left on large screens (#9772) --- client/src/blog/post.scss | 45 +++++++++++++++++++++++++++++----- client/src/blog/post.tsx | 14 ++++------- client/src/document/index.scss | 5 ++-- 3 files changed, 47 insertions(+), 17 deletions(-) diff --git a/client/src/blog/post.scss b/client/src/blog/post.scss index 91a12dec67ce..477c49f10f2a 100644 --- a/client/src/blog/post.scss +++ b/client/src/blog/post.scss @@ -22,23 +22,56 @@ grid-template-columns: minmax(auto, 1fr) minmax(0, 52rem) minmax(15rem, 1fr); } - > .sidebar-container { + @media screen and (min-width: $screen-xxl) { + grid-template-areas: + "toc post place" + "toc newsletter place"; + grid-template-columns: minmax(15rem, 1fr) minmax(0, 52rem) minmax( + 15rem, + 1fr + ); + } + + > .toc-container { --offset: var(--top-nav-height); display: none; - .toc-container { - position: unset; - top: auto; - } - @media screen and (min-width: $screen-lg) { display: flex; + flex-direction: column; grid-area: toc; .toc > nav { margin-top: 2rem; } } + @media screen and (min-width: $screen-xxl) { + display: contents; + + .place.side, + .toc { + height: max-content; + mask-image: linear-gradient( + to bottom, + rgba(0, 0, 0, 0) 0%, + rgb(0, 0, 0) 3rem calc(100% - 3rem), + rgba(0, 0, 0, 0) 100% + ); + max-height: calc(100vh - var(--offset)); + overflow: auto; + position: sticky; + top: var(--offset); + } + + .place.side { + grid-area: place; + margin-top: 0; + + > .pong-box { + margin-top: 2rem; + } + } + } } > .section-newsletter { diff --git a/client/src/blog/post.tsx b/client/src/blog/post.tsx index 2062a19417ea..e4e19fe2b3d6 100644 --- a/client/src/blog/post.tsx +++ b/client/src/blog/post.tsx @@ -194,15 +194,11 @@ export function BlogPost(props: HydrationData) { <> {doc && blogMeta && (
-
-
- - {PLACEMENT_ENABLED && !blogMeta?.sponsored && } -
+
+ + {PLACEMENT_ENABLED && !blogMeta?.sponsored && }