This document outlines the planned features and structure for My UI Framework.
-
App Component:
- Inserts the theme for the entire application.
- Only accepts a single child component of type
StyledApp
.
-
StyledApp Component:
- Only accepts
Page
components as children. - Throws an error if any other component is inserted.
- Only accepts
-
Page Component:
- Accepts various components such as
AppBar
,Content
,Sections
, andFooter
. - Props:
useParentFooter
(boolean): Determines whether to use the parent's footer.useMasterAppBar
(boolean): Determines whether to use the master page's appbar.customizeMaster
(object): Customize the parent master's theme.
- Accepts various components such as
-
Content, Sections, Footer Components:
- Components that can be inserted inside the
Page
component.
- Components that can be inserted inside the
- Pages can set
useMaster
tofalse
to define their own appbar or footer. - Pages can customize the parent master's theme using
customizeMaster
prop. - Setting
useMaster
tofalse
allows pages to define their own appbar or footer.
- If a page is set as master (
useMaster: true
), its appbar and footer can be used by other pages.
// Example of App component usage
import { App, StyledApp, Page, AppBar, Content, Footer } from 'my-ui-framework';
function MyApp() {
return (
<App>
<StyledApp>
<Page useMasterAppBar={true}>
<AppBar title="Home" />
<Content>
{/* Content components */}
</Content>
<Footer useParentFooter={true} />
</Page>
<Page useMasterAppBar={true} useParentFooter={false} customizeMaster={{ backgroundColor: 'blue' }}>
<AppBar title="About" />
<Content>
{/* Content components */}
</Content>
<Footer>
{/* Custom Footer */}
</Footer>
</Page>
</StyledApp>
</App>
);
}