-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BA-1851: Add Missing MDX Doc Files for BaseApp Frontend Packages - Group 2 #168
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,77 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
import { Meta } from '@storybook/addon-docs' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
<Meta title="@baseapp-frontend | components/Navigation/AccountPopover" /> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
# Component Documentation | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
## AccountPopover | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
- **Purpose**: A popover menu component that displays user account-related options and actions. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
- **Expected Behavior**: Opens on click of the account trigger button, displaying a menu with user profile information and navigation options. Closes when clicking outside or selecting a menu item. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
## Use Cases | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
- **Current Usage**: Used in the main application header for user account management and navigation. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
- **Potential Usage**: Could be used in: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
- User profile sections | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
- Settings panels | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
- Account management interfaces | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
- Navigation drawers | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
- Dashboard headers | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
## Props | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
- **MenuItems** (MenuItem[]): Array of menu items containing label and onClick handlers for each action | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
- **PopoverStyles** (object): Styles for the popover component | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
- **CurrentUser** (object): The current user object containing profile information | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
- **SwitchProfileMenu** (object): The switch profile menu object containing label and onClick handlers for each action | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
- **SwitchProfileMenuProps** (object): The switch profile menu props object containing label and onClick handlers for each action | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
- **ProfilesList** (object): The profiles list object containing label and onClick handlers for each action | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
- **ProfilesListProps** (object): The profiles list props object containing label and onClick handlers for each action | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
- **AddProfileMenuItem** (object): The add profile menu item object containing label and onClick handlers for each action | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
- **AddProfileMenuItemProps** (object): The add profile menu item props object containing label and onClick handlers for each action | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
- **LogoutItemProps** (object): The logout menu item props object containing label and onClick handlers for each action | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
## Notes | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
- **Related Components**: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
- Header: Parent component that contains the AccountPopover | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
- Popover: Base component used for the popup interface | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
- MenuItem: Used for individual menu options | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
- AccountMenu: Wrapper component that manages the popover state | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
## Example Usage | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
```javascript | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
import { AccountPopover } from '@baseapp-frontend/design-system' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
const MyComponent = () => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
return ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
<AccountPopover | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
MenuItemsProps={{ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
menuItems: [ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
{ label: 'Profile', onClick: () => console.log('Profile clicked') }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
{ label: 'Settings', onClick: () => console.log('Settings clicked') }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
}} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
SwitchProfileMenuProps={{ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
label: 'Switch Profile', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
onClick: () => console.log('Switch Profile clicked'), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
}} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
ProfilesListProps={{ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
label: 'Profiles List', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
onClick: () => console.log('Profiles List clicked'), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
}} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
AddProfileMenuItemProps={{ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
label: 'Add Profile', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
onClick: () => console.log('Add Profile clicked'), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
}} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
LogoutItemProps={{ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
label: 'Logout', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
onClick: () => console.log('Logout clicked'), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
}} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
/> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
export default MyComponent | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
``` | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Comment on lines
+45
to
+77
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Update example usage to match simplified props structure. The example usage should reflect the simplified props structure for better clarity. Consider updating the example: const MyComponent = () => {
return (
<AccountPopover
- MenuItemsProps={{
- menuItems: [
+ menuItems={[
{ label: 'Profile', onClick: () => console.log('Profile clicked') },
{ label: 'Settings', onClick: () => console.log('Settings clicked') },
- ],
- }}
- SwitchProfileMenuProps={{
+ ]}
+ switchProfile={{
label: 'Switch Profile',
onClick: () => console.log('Switch Profile clicked'),
}}
- ProfilesListProps={{
- label: 'Profiles List',
- onClick: () => console.log('Profiles List clicked'),
- }}
- AddProfileMenuItemProps={{
- label: 'Add Profile',
- onClick: () => console.log('Add Profile clicked'),
- }}
- LogoutItemProps={{
- label: 'Logout',
- onClick: () => console.log('Logout clicked'),
+ profiles={{
+ list: [],
+ onAdd: () => console.log('Add Profile clicked'),
}}
+ onLogout={() => console.log('Logout clicked')}
/>
)
} 📝 Committable suggestion
Suggested change
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
import { Meta } from '@storybook/addon-docs' | ||
|
||
<Meta title="@baseapp-frontend | components/Navigation/Header" /> | ||
|
||
# Component Documentation | ||
|
||
## Header | ||
|
||
- **Purpose**: A versatile header component that provides navigation controls and branding elements for the application layout. | ||
- **Expected Behavior**: Renders a customizable app bar with optional logo, navigation toggle, and account menu. Adapts its layout based on theme settings and screen size. | ||
|
||
## Use Cases | ||
|
||
- **Current Usage**: Used as the main navigation header across the application, providing consistent branding and navigation controls. | ||
- **Potential Usage**: Could be used in: | ||
- Admin dashboards | ||
- Web applications requiring consistent navigation | ||
- Portals with user account management | ||
- Applications with multiple layout options | ||
|
||
## Props | ||
|
||
- **settings** (object): Configuration object for theme and layout settings | ||
- **themeLayout**: Determines the header layout ('horizontal' | 'centered' | 'vertical') | ||
- **children** (ReactNode): Optional content to render within the header | ||
- **onOpenNav** (function): Callback function for handling navigation menu toggle | ||
- **LogoIcon** (component): Custom logo component to display in the header | ||
- **AccountMenu** (component): Custom account menu component, defaults to DefaultAccountMenu | ||
- **AccountMenuProps** (object): Props passed to the AccountMenu component | ||
- **ToolbarProps** (object): Props passed to the underlying MUI Toolbar component | ||
Comment on lines
+23
to
+30
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Enhance props documentation with type information and required/optional status The props section should clearly indicate:
Example format: - **settings** (object, required): Configuration object for theme and layout settings
- **themeLayout** ('horizontal' | 'centered' | 'vertical'): Determines the header layout
- Default: { themeLayout: 'horizontal' } |
||
|
||
## Notes | ||
|
||
- **Related Components**: | ||
- Logo: For branding display | ||
- AccountMenu: For user account actions | ||
- MenuIcon: For navigation toggle | ||
- Toolbar: For layout structure | ||
|
||
## Example Usage | ||
|
||
```javascript | ||
import { Header } from '@baseapp-frontend/design-system' | ||
import { LogoIcon } from '@baseapp-frontend/design-system' | ||
import { AccountMenu } from '@baseapp-frontend/design-system' | ||
|
||
const MyComponent = () => { | ||
return ( | ||
<Header settings={{ themeLayout: 'horizontal' }}> | ||
<LogoIcon /> | ||
<AccountMenu /> | ||
</Header> | ||
) | ||
} | ||
|
||
export default MyComponent | ||
``` |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
import { Meta } from '@storybook/addon-docs' | ||
|
||
<Meta title="@baseapp-frontend | components/Navigation/NavCentered" /> | ||
|
||
# Component Documentation | ||
|
||
## NavCentered | ||
|
||
- **Purpose**: A navigation component that provides a centered horizontal menu layout for desktop views and transforms into a drawer for mobile views. | ||
- **Expected Behavior**: On desktop screens (lg and up), displays as a horizontal scrollable navigation bar with centered menu items. On mobile screens (lgDown), transforms into a vertical drawer component. | ||
|
||
## Use Cases | ||
|
||
- **Current Usage**: Used as a centered horizontal navigation component with responsive mobile drawer. | ||
- **Potential Usage**: Could be used in: | ||
- Applications requiring centered horizontal navigation | ||
- Interfaces needing scrollable menu content | ||
- Responsive web applications | ||
- Systems with desktop and mobile navigation patterns | ||
- Content-focused layouts where centered navigation is preferred | ||
|
||
## Props | ||
|
||
- **navData** (array): Navigation items data containing routes and content | ||
- **openNav** (boolean): Controls visibility of mobile navigation drawer | ||
- **onCloseNav** (function): Callback when mobile navigation drawer closes | ||
|
||
## Notes | ||
|
||
- **Related Components**: | ||
- Scrollbar: Handles horizontal scrolling of navigation items | ||
- NavSectionHorizontal: Renders horizontal navigation items with tab layout | ||
- VerticalDrawer: Mobile view navigation component | ||
- useResponsive: Hook for responsive breakpoint detection | ||
|
||
## Example Usage | ||
|
||
```javascript | ||
import { NavCentered } from '@baseapp-frontend/design-system' | ||
|
||
const MyComponent = () => { | ||
const [openNav, setOpenNav] = useState(false) | ||
return ( | ||
<NavCentered | ||
navData={[ | ||
{ title: 'Home', icon: <MenuIcon /> }, | ||
{ title: 'About', icon: <InfoIcon /> }, | ||
{ title: 'Contact', icon: <ContactIcon /> }, | ||
]} | ||
openNav={openNav} | ||
onCloseNav={() => setOpenNav(false)} | ||
/> | ||
) | ||
} | ||
|
||
export default MyComponent | ||
``` |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import { Meta } from '@storybook/addon-docs' | ||
|
||
<Meta title="@baseapp-frontend | components/Navigation/NavHorizontal" /> | ||
|
||
# Component Documentation | ||
|
||
## NavHorizontal | ||
|
||
- **Purpose**: A horizontal navigation component that provides a secondary navigation bar below the main header. | ||
- **Expected Behavior**: On desktop screens (lg and up), displays as a horizontal navigation bar fixed below the header with centered menu items and horizontal scrolling if needed. On mobile screens (lgDown), transforms into a vertical drawer component. Uses blur effect on the background. | ||
|
||
## Use Cases | ||
|
||
- **Current Usage**: Secondary horizontal navigation bar below main header. | ||
- **Potential Usage**: Could be used in: | ||
- Multi-level navigation systems | ||
- Complex web applications requiring secondary navigation | ||
- Interfaces needing horizontally scrollable navigation items | ||
- Applications with responsive navigation requirements | ||
- Systems with desktop and mobile navigation patterns | ||
|
||
## Props | ||
|
||
- **navData** (array): Navigation items data containing routes and content | ||
- **openNav** (boolean): Controls visibility of mobile navigation drawer | ||
- **onCloseNav** (function): Callback when mobile navigation drawer closes | ||
Comment on lines
+24
to
+26
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Enhance props documentation with type information Add type information and required/optional status for each prop. - **navData** (array): Navigation items data containing routes and content
- **openNav** (boolean): Controls visibility of mobile navigation drawer
- **onCloseNav** (function): Callback when mobile navigation drawer closes
+ **navData** (NavigationItem[], required): Array of navigation items containing routes and content
+ ```typescript
+ interface NavigationItem {
+ title: string;
+ icon?: React.ReactNode;
+ path?: string;
+ }
+ ```
+ **openNav** (boolean, required): Controls visibility of mobile navigation drawer
+ **onCloseNav** (() => void, required): Callback function invoked when mobile navigation drawer closes |
||
|
||
## Notes | ||
|
||
- **Related Components**: | ||
- Scrollbar: Handles horizontal scrolling of navigation items | ||
- NavSectionHorizontal: Renders horizontal navigation items | ||
- VerticalDrawer: Mobile view navigation component | ||
- HeaderShadow: Adds shadow effect below navigation | ||
- AppBar: Material-UI container component | ||
|
||
## Example Usage | ||
|
||
```javascript | ||
import { NavHorizontal } from '@baseapp-frontend/design-system' | ||
|
||
const MyComponent = () => { | ||
const [openNav, setOpenNav] = useState(false) | ||
return ( | ||
<NavHorizontal | ||
navData={[ | ||
{ title: 'Home', icon: <MenuIcon /> }, | ||
{ title: 'About', icon: <InfoIcon /> }, | ||
{ title: 'Contact', icon: <ContactIcon /> }, | ||
]} | ||
openNav={openNav} | ||
onCloseNav={() => setOpenNav(false)} | ||
/> | ||
) | ||
} | ||
|
||
export default MyComponent | ||
``` |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
import { Meta } from '@storybook/addon-docs' | ||
|
||
<Meta title="@baseapp-frontend | components/Navigation/NavMini" /> | ||
|
||
# Component Documentation | ||
## NavMini | ||
|
||
- **Purpose**: A compact navigation component that provides a fixed-width mini sidebar menu with icon-only display for desktop views and transforms into a drawer for mobile views. | ||
- **Expected Behavior**: On desktop screens (lg and up), displays as a narrow vertical sidebar with width NAV_WIDTH.MINI containing only icons. On mobile screens (lgDown), transforms into a full drawer component. Includes optional logo placement and navigation toggle button. | ||
|
||
## Use Cases | ||
|
||
- **Current Usage**: Used as a space-efficient navigation sidebar when minimal screen space usage is desired. | ||
- **Potential Usage**: Could be used in: | ||
- Applications requiring minimal-width navigation | ||
- Interfaces prioritizing content space | ||
- Responsive web applications | ||
- Systems needing collapsible navigation options | ||
- Dashboards with space constraints | ||
|
||
## Props | ||
|
||
- **navData** (array): Navigation items data containing routes and content | ||
- **settings** (object): Configuration settings for the navigation component | ||
- **setSettings** (function): Callback to update navigation settings | ||
- **LogoIcon** (component): Optional custom logo component to display at top | ||
- **openNav** (boolean): Controls visibility of mobile navigation drawer | ||
- **onCloseNav** (function): Callback when mobile navigation drawer closes | ||
- **hideToggleButton** (boolean): Optional flag to hide the navigation toggle button, defaults to false | ||
|
||
## Notes | ||
|
||
- **Related Components**: | ||
- Logo: Optional branding component at top | ||
- NavSectionMini: Renders mini navigation items | ||
- NavToggleButton: Button to expand/collapse navigation | ||
- VerticalDrawer: Mobile view navigation component | ||
- Box: Container component with responsive styles | ||
- Stack: Vertical layout container | ||
|
||
## Example Usage | ||
|
||
```javascript | ||
import { NavMini } from '@baseapp-frontend/design-system' | ||
import { FavoriteIcon, MentionIcon, MenuIcon, PenEditIcon } from '@baseapp-frontend/design-system' | ||
import { BaseAppLogoCondensed } from '@baseapp-frontend/design-system' | ||
|
||
const MyComponent = () => { | ||
return ( | ||
<NavMini | ||
navData={[ | ||
{ | ||
subheader: 'BASEAPP', | ||
items: [{ title: 'Home', icon: <MenuIcon /> }], | ||
}, | ||
{ | ||
subheader: 'BASIC', | ||
items: [ | ||
{ title: 'Feature Requests', icon: <MentionIcon /> }, | ||
{ title: 'Flat Pages', icon: <PenEditIcon /> }, | ||
{ title: 'Feedback', icon: <FavoriteIcon /> }, | ||
], | ||
}, | ||
]} | ||
settings={defaultTheme.settings} | ||
LogoIcon={BaseAppLogoCondensed} | ||
openNav={false} | ||
hideToggleButton={true} | ||
onCloseNav={() => console.log('NavMini closed')} | ||
/> | ||
) | ||
} | ||
|
||
export default MyComponent | ||
``` |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
import { Meta } from '@storybook/addon-docs' | ||
|
||
<Meta title="@baseapp-frontend | components/Navigation/NavVertical" /> | ||
|
||
# Component Documentation | ||
|
||
## NavVertical | ||
|
||
- **Purpose**: A vertical navigation component that provides a fixed-width sidebar menu with scrollable content and optional logo. | ||
- **Expected Behavior**: Displays as a vertical sidebar on desktop screens with a width of NAV_WIDTH.VERTICAL. On mobile screens (lgDown breakpoint), transforms into a drawer component. Includes optional logo placement and scrollable navigation sections. | ||
|
||
## Use Cases | ||
|
||
- **Current Usage**: Main vertical navigation sidebar for desktop views. | ||
- **Potential Usage**: Could be used in: | ||
- Applications requiring fixed sidebar navigation | ||
- Interfaces needing scrollable menu content | ||
- Layouts with optional logo placement | ||
- Responsive applications with mobile drawer navigation | ||
- Systems requiring collapsible navigation options | ||
|
||
## Props | ||
|
||
- **settings** (object): Configuration settings for the navigation component | ||
- **setSettings** (function): Callback to update navigation settings | ||
- **navData** (array): Navigation items data containing routes and content | ||
Comment on lines
+24
to
+26
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Document settings type structure Add detailed type information for the settings object. - **settings** (object): Configuration settings for the navigation component
- **setSettings** (function): Callback to update navigation settings
+ **settings** (UISettings, required): Configuration settings for the navigation component
+ ```typescript
+ interface UISettings {
+ themeMode: 'light' | 'dark';
+ themeLayout: 'vertical' | 'horizontal' | 'mini';
+ themeStretch: boolean;
+ themeContrast: 'default' | 'bold';
+ }
+ ```
+ **setSettings** ((settings: Partial<UISettings>) => void, required): Callback to update navigation settings |
||
- **LogoIcon** (component): Optional custom logo component to display at top | ||
- **openNav** (boolean): Controls visibility of mobile navigation drawer | ||
- **onCloseNav** (function): Callback when mobile navigation drawer closes | ||
- **hideToggleButton** (boolean): Optional flag to hide the navigation toggle button, defaults to false | ||
|
||
## Notes | ||
|
||
- **Related Components**: | ||
- Scrollbar: Handles scrollable content within navigation | ||
- NavSectionVertical: Renders navigation item sections | ||
- NavToggleButton: Button to expand/collapse navigation | ||
- VerticalDrawer: Mobile view navigation component | ||
- Logo: Optional branding component | ||
|
||
## Example Usage | ||
|
||
```javascript | ||
import { NavVertical } from '@baseapp-frontend/design-system' | ||
import { BaseAppLogoCondensed } from '@baseapp-frontend/design-system' | ||
|
||
const MyComponent = () => { | ||
const [openNav, setOpenNav] = useState(false) | ||
return ( | ||
<NavVertical | ||
navData={[ | ||
{ title: 'Home', icon: <MenuIcon /> }, | ||
{ title: 'About', icon: <InfoIcon /> }, | ||
{ title: 'Contact', icon: <ContactIcon /> }, | ||
]} | ||
openNav={openNav} | ||
onCloseNav={() => setOpenNav(false)} | ||
hideToggleButton={true} | ||
/> | ||
) | ||
} | ||
|
||
export default MyComponent | ||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Simplify props structure to reduce duplication.
The current props structure has several overlapping props with similar purposes (e.g.,
SwitchProfileMenu
/SwitchProfileMenuProps
,ProfilesList
/ProfilesListProps
). Consider simplifying by:Example structure: