|
8 | 8 | useContext,
|
9 | 9 | } from 'react'
|
10 | 10 | import { ClassTable } from '@/components/ClassTable'
|
11 |
| -import { useIsHome } from '@/hooks/useIsHome' |
12 | 11 | import { usePrevNext } from '@/hooks/usePrevNext'
|
13 | 12 | import Link from 'next/link'
|
14 | 13 | import { SidebarLayout, SidebarContext } from '@/layouts/SidebarLayout'
|
@@ -165,56 +164,51 @@ export function ContentsLayout({ children, meta, classes, tableOfContents }) {
|
165 | 164 | ]
|
166 | 165 |
|
167 | 166 | const { currentSection, registerHeading, unregisterHeading } = useTableOfContents(toc)
|
168 |
| - let isHome = useIsHome() |
169 | 167 | let { prev, next } = usePrevNext()
|
170 | 168 |
|
171 | 169 | return (
|
172 |
| - <div id={meta.containerId} className="pt-10 pb-16 w-full"> |
173 |
| - <div className="flex"> |
174 |
| - <div className="flex-auto px-6 xl:px-8"> |
175 |
| - <PageHeader |
176 |
| - title={meta.title} |
177 |
| - description={meta.description} |
178 |
| - badge={{ key: 'Tailwind CSS version', value: meta.featureVersion }} |
179 |
| - border={!classes && meta.headerSeparator !== false} |
180 |
| - /> |
181 |
| - <ContentsContext.Provider value={{ registerHeading, unregisterHeading }}> |
182 |
| - {classes && ( |
183 |
| - <ClassTable {...(isValidElement(classes) ? { custom: classes } : classes)} /> |
184 |
| - )} |
185 |
| - {children} |
186 |
| - </ContentsContext.Provider> |
187 |
| - {(prev || next) && ( |
188 |
| - <> |
189 |
| - <hr /> |
190 |
| - <div className="-mt-6 flex justify-between"> |
191 |
| - {prev && ( |
192 |
| - <Link href={prev.href}> |
193 |
| - <a className="font-medium text-blue-500 underline hover:text-blue-700"> |
194 |
| - ← {prev.shortTitle || prev.title} |
195 |
| - </a> |
196 |
| - </Link> |
197 |
| - )} |
198 |
| - {next && ( |
199 |
| - <Link href={next.href}> |
200 |
| - <a className="font-medium text-blue-500 underline hover:text-blue-700"> |
201 |
| - {next.shortTitle || next.title} → |
202 |
| - </a> |
203 |
| - </Link> |
204 |
| - )} |
205 |
| - </div> |
206 |
| - </> |
| 170 | + <div id={meta.containerId} className="pt-10 pb-16 w-full flex"> |
| 171 | + <div className="min-w-0 flex-auto px-6 xl:px-8"> |
| 172 | + <PageHeader |
| 173 | + title={meta.title} |
| 174 | + description={meta.description} |
| 175 | + badge={{ key: 'Tailwind CSS version', value: meta.featureVersion }} |
| 176 | + border={!classes && meta.headerSeparator !== false} |
| 177 | + /> |
| 178 | + <ContentsContext.Provider value={{ registerHeading, unregisterHeading }}> |
| 179 | + {classes && <ClassTable {...(isValidElement(classes) ? { custom: classes } : classes)} />} |
| 180 | + {children} |
| 181 | + </ContentsContext.Provider> |
| 182 | + {(prev || next) && ( |
| 183 | + <> |
| 184 | + <hr /> |
| 185 | + <div className="-mt-6 flex justify-between"> |
| 186 | + {prev && ( |
| 187 | + <Link href={prev.href}> |
| 188 | + <a className="font-medium text-blue-500 underline hover:text-blue-700"> |
| 189 | + ← {prev.shortTitle || prev.title} |
| 190 | + </a> |
| 191 | + </Link> |
| 192 | + )} |
| 193 | + {next && ( |
| 194 | + <Link href={next.href}> |
| 195 | + <a className="font-medium text-blue-500 underline hover:text-blue-700"> |
| 196 | + {next.shortTitle || next.title} → |
| 197 | + </a> |
| 198 | + </Link> |
| 199 | + )} |
| 200 | + </div> |
| 201 | + </> |
| 202 | + )} |
| 203 | + </div> |
| 204 | + <div className="hidden xl:text-sm xl:block flex-none w-64 pl-8 pr-12"> |
| 205 | + <div className="flex flex-col justify-between overflow-y-auto sticky max-h-(screen-18) -mt-10 pt-10 pb-4 top-18"> |
| 206 | + {toc.length > 0 && ( |
| 207 | + <div className="mb-8"> |
| 208 | + <TableOfContents tableOfContents={toc} currentSection={currentSection} /> |
| 209 | + </div> |
207 | 210 | )}
|
208 | 211 | </div>
|
209 |
| - <div className="hidden xl:text-sm xl:block flex-none w-64 pl-8 pr-12"> |
210 |
| - <div className="flex flex-col justify-between overflow-y-auto sticky max-h-(screen-18) -mt-10 pt-10 pb-4 top-18"> |
211 |
| - {toc.length > 0 && ( |
212 |
| - <div className="mb-8"> |
213 |
| - <TableOfContents tableOfContents={toc} currentSection={currentSection} /> |
214 |
| - </div> |
215 |
| - )} |
216 |
| - </div> |
217 |
| - </div> |
218 | 212 | </div>
|
219 | 213 | </div>
|
220 | 214 | )
|
|
0 commit comments