22import " ../styles/global.css" ;
33import Header from " ../components/Header.astro" ;
44import TableOfContents from " ../components/TableOfContents.astro" ;
5- import PlaybookNav from " ../components/PlaybookNav.astro" ;
65import TutorialLinks from " ../components/TutorialLinks.astro" ;
76import Footer from " ../components/Footer.astro" ;
87import site from " ../data/site.json" ;
@@ -12,12 +11,10 @@ interface Props {
1211 description? : string ;
1312 headings? : { depth: number ; slug: string ; text: string }[];
1413 currentPath? : string ;
15- currentSection? : string ;
1614 jsonLd? : Record <string , unknown >;
1715}
1816
19- const { title, description, headings = [], currentPath = " /" , currentSection = " " , jsonLd } = Astro .props ;
20- const isPlaybook = currentSection === " playbook" || currentSection .startsWith (" playbook/" );
17+ const { title, description, headings = [], currentPath = " /" , jsonLd } = Astro .props ;
2118const pageDescription = description || site .description ;
2219const pageTitle = ` ${title } — ${site .title } ` ;
2320const canonicalUrl = new URL (Astro .url .pathname , Astro .site );
@@ -31,6 +28,7 @@ const ogImage = new URL("/tutorial-git/images/og-banner.png", Astro.site);
3128 <meta name =" viewport" content =" width=device-width, initial-scale=1" />
3229 <title >{ pageTitle } </title >
3330 <meta name =" description" content ={ pageDescription } />
31+ <link rel =" icon" href ={ ` ${import .meta .env .BASE_URL }favicon.svg ` } type =" image/svg+xml" />
3432 <link rel =" canonical" href ={ canonicalUrl } />
3533
3634 <!-- Open Graph -->
@@ -47,12 +45,7 @@ const ogImage = new URL("/tutorial-git/images/og-banner.png", Astro.site);
4745 <meta name =" twitter:description" content ={ pageDescription } />
4846 <meta name =" twitter:image" content ={ ogImage } />
4947
50- <link rel =" preconnect" href =" https://fonts.googleapis.com" />
51- <link rel =" preconnect" href =" https://fonts.gstatic.com" crossorigin />
52- <link
53- href =" https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;600;700&family=Roboto+Mono:wght@400;500&display=swap"
54- rel =" stylesheet"
55- />
48+
5649
5750 { jsonLd && (
5851 <script type = " application/ld+json" set :html = { JSON .stringify (jsonLd )} />
@@ -70,16 +63,54 @@ const ogImage = new URL("/tutorial-git/images/og-banner.png", Astro.site);
7063 <Header currentPath ={ currentPath } />
7164 <div class =" site-main" >
7265 <TableOfContents headings ={ headings } />
66+ <div class =" resize-handle" data-side =" left" ></div >
7367 <main class =" content" id =" main-content" >
7468 <h1 >{ title } </h1 >
7569 <slot />
7670 </main >
77- { isPlaybook ? (
78- <PlaybookNav currentSection = { currentSection } />
79- ) : (
80- <TutorialLinks />
81- )}
71+ <div class =" resize-handle" data-side =" right" ></div >
72+ <TutorialLinks />
8273 </div >
8374 <Footer />
75+
76+ <script is:inline >
77+ (function () {
78+ var root = document.documentElement;
79+ document.querySelectorAll(".resize-handle").forEach(function (handle) {
80+ var side = handle.getAttribute("data-side");
81+ handle.addEventListener("mousedown", function (e) {
82+ e.preventDefault();
83+ var startX = e.clientX;
84+ var col = side === "left" ? 0 : 4;
85+ var grid = handle.parentElement;
86+ var current = grid.querySelectorAll(
87+ side === "left" ? ".sidebar-toc" : ".sidebar-tutorials"
88+ )[0];
89+ var startWidth = current ? current.offsetWidth : 256;
90+
91+ function onMove(e) {
92+ var delta = e.clientX - startX;
93+ var newWidth = side === "left" ? startWidth + delta : startWidth - delta;
94+ newWidth = Math.max(140, Math.min(400, newWidth));
95+ var cols = getComputedStyle(grid).gridTemplateColumns.split(" ");
96+ cols[col] = newWidth + "px";
97+ grid.style.gridTemplateColumns = cols.join(" ");
98+ }
99+
100+ function onUp() {
101+ document.removeEventListener("mousemove", onMove);
102+ document.removeEventListener("mouseup", onUp);
103+ document.body.style.userSelect = "";
104+ document.body.style.cursor = "";
105+ }
106+
107+ document.body.style.userSelect = "none";
108+ document.body.style.cursor = "col-resize";
109+ document.addEventListener("mousemove", onMove);
110+ document.addEventListener("mouseup", onUp);
111+ });
112+ });
113+ })();
114+ </script >
84115 </body >
85116</html >
0 commit comments