aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/atoms/layout/main/main.tsx
blob: 5854900a0c5062edd4202bf6083619e104a03445 (plain)
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
import {
  forwardRef,
  type HTMLAttributes,
  type ReactNode,
  type ForwardRefRenderFunction,
} from 'react';

export type MainProps = HTMLAttributes<HTMLElement> & {
  /**
   * The main body.
   */
  children: ReactNode;
};

const MainWithRef: ForwardRefRenderFunction<HTMLElement, MainProps> = (
  { children, ...props },
  ref
) => (
  <main {...props} ref={ref}>
    {children}
  </main>
);

/**
 * Main component
 *
 * Render a main element.
 */
export const Main = forwardRef(MainWithRef);