The WieldyLayout component provides a flexible and customizable layout solution for your React applications. It is built using Ant Design's Layout components and is highly configurable via styles, classes, and layout options. The WieldyLayout supports a modular architecture for the header, footer, sidebar, and content areas, allowing developers to create dynamic and adaptive layouts effortlessly.
Here is a basic example of how to use the WieldyLayout component:
Copy import React from "react" ;
import { WieldyLayout } from "./WieldyLayout" ;
const layoutConfig = {
styles : {
header : { backgroundColor : "#fff" } ,
sidebar : { backgroundColor : "#f0f2f5" } ,
} ,
classes : {
root : "custom-root-class" ,
} ,
layoutOptions : {
header : { fixed : true } ,
sidebar : { hidden : false , fixed : true } ,
footer : { hidden : false } ,
} ,
};
const App = () => (
< WieldyLayout
header = {< div >Header Content</ div >}
sidebar = {< div >Sidebar Content</ div >}
footer = {< div >Footer Content</ div >}
styles = { layoutConfig .styles}
classes = { layoutConfig .classes}
layoutOptions = { layoutConfig .layoutOptions}
>
< div >Main Content</ div >
</ WieldyLayout >
);
export default App; The WieldyLayout component accepts the following props:
Description: Content to render in the header.
Description: Content to render in the footer.
Description: Content to render in the sidebar.
Description: Content to render in the right sidebar.
Description: Inline CSS styles for various layout sections.
Type: WieldyLayoutClasses
Description: CSS class names for various layout sections.
Type: WieldyLayoutOptions
Description: Configuration options for the header, footer, sidebar, and right sidebar.
Description: Main content to render within the layout.
WieldyLayoutClasses
Defines class names for various layout sections.
CSS class for the root layout.
CSS class for the header.
CSS class for the footer.
CSS class for the sidebar.
CSS class for the content.
CSS class for the right sidebar.
WieldyLayoutStyles
Defines inline styles for various layout sections.
Inline style for the root layout.
Inline style for the header.
Inline style for the footer.
Inline style for the sidebar.
Inline style for the content.
Inline style for the right sidebar.
WieldyLayoutOptions
Configuration options for layout sections.
Header Options
Whether the header is fixed.
Whether the header is hidden.
Spreads out the header items.
Sidebar Options
Whether the sidebar is hidden.
Fixed positioning for the sidebar.
Whether the sidebar is a drawer.
Whether the sidebar is fixed.
Footer Options
Whether the footer is fixed.
Whether the footer is hidden.
Spreads out the footer items.
The WieldyLayoutContextType allows developers to dynamically update layout options during runtime.
setHeaderOptions(options: WieldyLayoutHeaderOptions)
setSidebarOptions(options: WieldyLayoutSidebarOptions)
setRightSidebarOptions(options: WieldyLayoutSidebarOptions)
setFooterOptions(options: WieldyLayoutFooterOptions)
Advanced Example
Dynamically updating layout options using context:
The styles and classes props provide complete flexibility for styling:
Use the context API for dynamic layout changes.
Combine styles and classes for optimal customization.
Modularize reusable components like headers, footers, and sidebars.
Can I hide specific layout sections? Yes, use the hidden property in layoutOptions.
How do I style individual sections? Use the styles or classes props.
Does WieldyLayout support responsive design? Yes, you can leverage Ant Design’s grid system and media queries.
For further assistance, refer to the official documentation or contact support.