import { ReactNode, useEffect } from "react";
import FilterSection from "./FilterSection";
import { useMainContext } from "../MainProvider";

export function BasePostLayout({
	children,
	showSearchMode = false,
}: {
	children: ReactNode;
	showSearchMode?: boolean;
}) {
	const { setShowSearchMode } = useMainContext();
	useEffect(() => {
		setShowSearchMode(showSearchMode);
	}, [showSearchMode]);
	return (
		<>
			<div className="min-h-screen bg-gray-50">
				<div className=" flex">
					<div className="w-1/6">
						<FilterSection></FilterSection>
					</div>
					<div className="w-5/6 p-4 py-8">{children}</div>
				</div>
			</div>
		</>
	);
}
export default BasePostLayout;
