@@ -23,18 +23,21 @@ const DocLink = ({
2323 label,
2424 onClick,
2525 setOpen,
26+ matchPaths,
2627} : {
2728 uri : string ;
2829 label : string | React . ReactNode ;
2930 onClick ?: ( ) => void ;
3031 setOpen : ( open : boolean ) => void ;
32+ matchPaths ?: string [ ] ;
3133} ) => {
3234 const router = useRouter ( ) ;
3335 const url = new URL ( `${ router . asPath } ` , HOST ) ;
3436 url . search = '' ;
3537 url . hash = '' ;
3638 const stringUrl = url . toString ( ) . substr ( HOST . length , Infinity ) ;
37- const isActive = uri === extractPathWithoutFragment ( stringUrl ) ;
39+ const path = extractPathWithoutFragment ( stringUrl ) ;
40+ const isActive = matchPaths ? matchPaths . includes ( path ) : uri === path ;
3841 return (
3942 < Link
4043 href = { uri }
@@ -170,6 +173,13 @@ const getReferencePath = [
170173 '/understanding-json-schema/reference/generic' ,
171174 '/understanding-json-schema/reference' ,
172175] ;
176+ const getReleaseNotesDraftPath = [
177+ '/specification/release-notes' ,
178+ '/draft/2020-12/release-notes' ,
179+ '/draft/2019-09/release-notes' ,
180+ '/draft-07/json-schema-release-notes' ,
181+ '/draft-06/json-schema-release-notes' ,
182+ ] ;
173183const getSpecificationPath = [
174184 '/draft/2020-12' ,
175185 '/draft/2019-09' ,
@@ -182,6 +192,10 @@ const getSpecificationPath = [
182192 '/specification/json-hyper-schema' ,
183193 '/specification' ,
184194 '/specification-links' ,
195+ '/draft/2020-12/release-notes' ,
196+ '/draft/2019-09/release-notes' ,
197+ '/draft-07/json-schema-release-notes' ,
198+ '/draft-06/json-schema-release-notes' ,
185199] ;
186200
187201export const SidebarLayout = ( { children } : { children : React . ReactNode } ) => {
@@ -191,6 +205,8 @@ export const SidebarLayout = ({ children }: { children: React.ReactNode }) => {
191205 const handleRotate = ( ) => setRotateChevron ( ! rotateChevron ) ;
192206 const rotate = rotateChevron ? 'rotate(180deg)' : 'rotate(0)' ;
193207 const pathWtihoutFragment = extractPathWithoutFragment ( router . asPath ) ;
208+ const shouldHideSidebar = pathWtihoutFragment === '/md-style-guide' ;
209+
194210 useEffect ( ( ) => {
195211 if ( window ) {
196212 window . addEventListener ( 'resize' , ( ) => {
@@ -261,16 +277,20 @@ export const SidebarLayout = ({ children }: { children: React.ReactNode }) => {
261277 </ div >
262278 </ div >
263279 < div className = 'dark:bg-slate-800 max-w-[1400px] grid grid-cols-1 lg:grid-cols-4 mx-4 md:mx-12' >
264- < div className = 'hidden lg:block mt-24 sticky top-24 h-[calc(100vh-6rem)] overflow-hidden' >
265- < div className = 'h-full overflow-y-auto scrollbar-hidden' >
266- < DocsNav open = { open } setOpen = { setOpen } />
267- < CarbonAds
268- className = 'lg:mt-8 w-4/5 mx-auto lg:ml-4'
269- variant = 'sidebar'
270- />
280+ { ! shouldHideSidebar && (
281+ < div className = 'hidden lg:block mt-24 sticky top-24 h-[calc(100vh-6rem)] overflow-hidden' >
282+ < div className = 'h-full overflow-y-auto scrollbar-hidden' >
283+ < DocsNav open = { open } setOpen = { setOpen } />
284+ < CarbonAds
285+ className = 'lg:mt-8 w-4/5 mx-auto lg:ml-4'
286+ variant = 'sidebar'
287+ />
288+ </ div >
271289 </ div >
272- </ div >
273- < div className = 'col-span-4 md:col-span-3 lg:mt-20 lg:w-5/6 mx-4 md:mx-0' >
290+ ) }
291+ < div
292+ className = { `lg:mt-20 mx-4 md:mx-0 ${ shouldHideSidebar ? 'col-span-4 w-full' : 'col-span-4 md:col-span-3 lg:w-5/6' } ` }
293+ >
274294 { children }
275295 </ div >
276296 </ div >
@@ -890,6 +910,7 @@ export const DocsNav = ({
890910 uri = '/specification/release-notes'
891911 label = 'Release notes'
892912 setOpen = { setOpen }
913+ matchPaths = { getReleaseNotesDraftPath }
893914 />
894915 < DocLink
895916 uri = '/specification/json-hyper-schema'
0 commit comments