aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/templates/page/page-sidebar.tsx
blob: 1b5ae9719037f5ff81a78b7618e3425586d08cb4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import { type ForwardRefRenderFunction, forwardRef } from 'react';
import { Aside, type AsideProps } from '../../atoms';
import styles from './page.module.scss';

export type PageSidebarProps = AsideProps;

const PageSidebarWithRef: ForwardRefRenderFunction<
  HTMLElement,
  PageSidebarProps
> = ({ children, className = '', ...props }, ref) => {
  const sidebarClass = `${styles.sidebar} ${className}`;

  return (
    <Aside {...props} className={sidebarClass} ref={ref}>
      <div className={styles.sidebar__body}>{children}</div>
    </Aside>
  );
};

export const PageSidebar = forwardRef(PageSidebarWithRef);