import type { FC } from 'react';
import React from 'react';
import cx from 'classnames';
import PageSwitch from '../pageSwitch';

const CLASSNAME = 'PageBody';
const TESTID = 'PageBody';

type PageSwitchProps = React.ComponentProps<typeof PageSwitch>;

interface Props extends Partial<PageSwitchProps> {
    children?: React.ReactNode;
    className?: string;
}

const PageBody: FC<Props> = ({ children, className, views, ...props }) => (
    <div className={cx(CLASSNAME, className)} data-testid={TESTID}>
        {views && <PageSwitch views={views} {...props} />}
        {children}
    </div>
);

export default PageBody;
