2025-10-27 14:20:43 +01:00

22 lines
658 B
TypeScript

import React from "react";
import { useSelector } from "react-redux";
import { RootState } from "../../redux/types";
interface MainContentProps {
children: React.ReactNode;
}
export const MainContent = ({ children }: MainContentProps) => {
const isSidebarOpen = useSelector((state: RootState) => state.ui.sidebarOpen);
const style: React.CSSProperties = {
marginLeft: isSidebarOpen ? "240px" : "30px",
padding: "24px",
minHeight: "100vh",
width: isSidebarOpen ? "calc(100% - 240px)" : "calc(100% - 30px)",
transition: "margin-left 0.3s ease-in-out, width 0.3s ease-in-out",
};
return <div style={style}>{children}</div>;
};