All files / src/apps/home/pages/docs DocsLayout.tsx

16.66% Statements 1/6
100% Branches 0/0
0% Functions 0/2
16.66% Lines 1/6

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33          1x                                                      
import DocTree from "@/components/docs/DocTree/DocTree";
import React from "react";
import { useLocation, useNavigate } from "react-router-dom";
import { docsData } from "./docsData";
 
const DocsLayout: React.FC<{ children: React.ReactNode }> = ({ children }) => {
  const location = useLocation();
  const navigate = useNavigate();
  const activeUrl = location.pathname.replace(/\/+$/, "");
 
  return (
    // The sidebar sits beside the article only from `lg`. At `md` the site's
    // own navigation already takes 14rem of the viewport, and a second column
    // of 16rem left the article about 300px wide — narrower than a title set
    // in the site's monospace face, which then overflowed the page.
    <div className="flex flex-col lg:flex-row items-start gap-8 lg:gap-10">
      <aside className="w-full lg:w-64 shrink-0 pt-8 pl-6 lg:pl-8 lg:sticky lg:top-8">
        <p className="text-xs font-semibold uppercase tracking-wide text-gray-400 dark:text-gray-500 mb-3">
          Documentation
        </p>
        <DocTree
          data={docsData}
          activeUrl={activeUrl}
          onNavigate={(url) => void navigate(url)}
        />
      </aside>
      <div className="flex-1 min-w-0 w-full">{children}</div>
    </div>
  );
};
 
export default DocsLayout;