All files / src/components/page/MainPage MainPage.tsx

100% Statements 4/4
100% Branches 5/5
100% Functions 2/2
100% Lines 4/4

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 34 35 36 37 38 39 40 41 42 43 44 45                    13x 596x   596x                             80x                                
import { usePageMeta } from "@/context/PageContext";
import React from "react";
 
export interface MainPageInterface {
  title: React.ReactNode;
  links?: React.ReactNode[];
  description?: React.ReactNode;
  children?: React.ReactNode;
}
 
const MainPage: React.FC<MainPageInterface> = (props) => {
  usePageMeta(props.title, false);
 
  return (
    <div>
      <h1 className="text-xl font-bold drop-shadow-lg">{props.title}</h1>
      <br />
      <hr />
      <br />
      {props.links && props.links.length > 0 && (
        <>
          <div className="flex justify-start items-start gap-x-4">
            {/* Keyed here rather than at the call site: `links` is an array
                of elements, so React wants a key on each, and every page that
                passed one got a console warning nobody read. The order is
                fixed (it is a toolbar, not a data list), so the index is a
                stable key. */}
            {props.links.map((link, i) => (
              <React.Fragment key={i}>{link}</React.Fragment>
            ))}
          </div>
          <br />
          <hr />
          <br />
        </>
      )}
      {props.description && <p>{props.description}</p>}
      <br></br>
      {props.children}
    </div>
  );
};
 
export default MainPage;