SidePanel
The side panel is the main navigation for the new Adjust platform design. In terms of visual hierarchy, it is on top of all other regular content or components on the page. Modal dialogs may overlay the side panel.
Example
Variant
Agency Users
AgencyUser
renders menu action of Agency User. It includes 2 sub component: MenuHeader
and MenuItem
Loading & Error state
Side Panel supports loading state with prop isLoading
in NavSection sub component. And it also supports to display a badge for error messages if any problems happen with ErrorState sub component in footer area.
Sub Components
The navigation component is based on two sub-components (NavSection
and NavItem
) and is responsible for rendering Navigation items in the proper place with the proper styles.
NavSection
The NavSection
component is used for rendering the first-level
navigation elements.
Name | Type | Description |
---|---|---|
id | string | Prop to provide a unique ID to the component. |
title | string | Prop to provide nav section title value |
brand | "datascape", "pulse", "campaign_lab", "dataworks", "appview", ... | Prop to provide a brand icon |
isActive | boolean | Prop to define the active section. |
isExpanded | boolean | Prop to define the expanded state. |
isDisabled | boolean | Prop to define the disabled section. |
notificationCount | number | Prop to define the notification badge. |
as | ElementType | Prop to allow external link component, such as: react-router-dom Link |
to | string, object | Prop to define the path of external link component |
onClick | (id: IDtype, isExpanded: boolean) => void | A callback function to inform the parent component with the item id and expanded state on click |
dataTestId | string | Prop to provide to unique data-testid |
children | ReactNode | Prop to provide to second and third level nav items. Please use only NavItem component as a child element. |
NavItem
The NavItem
component is used for rendering the navigation items.
Name | Type | Description |
---|---|---|
id | string | Prop to provide a unique ID to the component. |
type | 'headline', headline-labeled', 'plain' | Prop to identify the type of the nav item. |
title | string | Prop to provide item's title value. |
isActive | boolean | Prop to define the active item. |
isDisabled | boolean | Prop to define the disabled item. |
tooltipContent | string, ReactNode | Prop to define the item as the active item. |
as | ElementType | Prop to allow external link component, such as: react-router-dom Link |
to | string, object | Prop to define the path of external link component |
onClick | (id: IDtype, type?: NavItemType) => void | A callback function to inform the parent component with the item id and the type of item |
onClickToAction | (id: IDtype) => void | A callback function to inform parent component with the item id on icon button (plus icon) |
children | ReactNode | Prop to provide to second and third level nav items. Please use only NavItem component as a child element. |
dataTestId | string | Prop to provide to unique data-testid to item |
actionDataTestId | string | Prop to provide to unique data-testid to action button |
NavItem can be set as a link item:
- Anchor element (default) by adding its attributes such as
href
,target
, ... - External link component (e.g react-router-dom) by adding
as
and its attributes such asto
,replace
, ...
note
As default onClick
and onClickToAction
are still invoked when the link item is clicked. If not expectation, please handle these events by yourself (see above example)
import { Link } from 'react-router-dom';
const navItems = [
{
id: '1.1.1',
title: 'All Reports',
as: Link,
to: {
pathname: '/courses',
search: '?sort=name',
hash: '#the-hash'
}
},
{
id: '1.1.2',
title: 'Skan',
href: 'https://www.google.com/',
target: '_blank'
}
];
Account
The Account
component is a sub component of SidePanel to render the account information and actions.
Name | Type | Description |
---|---|---|
userName | string | Prop to provide user name |
accountName | string | Prop to provide title for the account name |
tooltipTitle | string | Prop to provide the tooltip content |
isActionMenuOpen | boolean | Prop to provide open state of action menu |
onClickButton | (isActionMenuOpen: boolean) => void | An onClick event to overwrite the icon button's onClick. |
children | ReactNode | Prop to provide the content of action menu, list of MenuItem |
action | ReactNode | Prop to provide action button for the action menu |
footerActions | ReactNode | Prop to provide footer's action buttons for action menu |
dataTestId | string | Prop to provide to unique data-testid |
Note: The action menu of Account
is customization of IconMenu component.
AgencyUser
The AgencyUser
component is a sub component of SidePanel to render the agency user information and actions.
Name | Type | Description |
---|---|---|
title | string | Prop to provide title for the agency user |
tooltipTitle | string | Prop to provide the tooltip content |
onToggleMenu | (isVisible: boolean) => void | A callback to inform open state of action menu. |
children | ReactNode | Prop to provide the content of action menu, includes: MenuHeader and list of MenuItem |
dataTestId | string | Prop to provide to unique data-testid |
Note: The action menu of AgencyUser
is a variant of IconMenu component.
LanguageSelector
The LanguageSelector
component is a sub component of SidePanel to render the language section.
Name | Type | Description |
---|---|---|
activeLanguage | string | Prop to provide the selected language value. |
tooltipTitle | string | Prop to provide the tooltip content |
children | ReactNode | Prop to provide the content of action menu, list of MenuItem |
dataTestId | string | Prop to provide to unique data-testid |
Note: The action menu of LanguageSelector
is a variant of IconMenu component.
MenuHeader
The MenuItem is the sub component to render header of action menu in AgencyUser
.
Name | Type | Description |
---|---|---|
children | ReactNode | Prop to provide the content of menu header |
MenuItem
The MenuItem
is the sub component to render list items of action menu in Account
, AgencyUser
, LanguageSelector
.
Name | Type | Description |
---|---|---|
id | 'string', 'number' | Prop to provide id of menu item |
isActive | boolean | Prop to provide checked state (AgencyUser , LanguageSelector ) |
isDisabled | boolean | Prop to provide disabled item |
icon | IconName | Prop to provide icon name |
children | ReactNode | Prop to provide the content of menu item |
onClick | (id: string) => void | Prop to provide a callback to inform the id of selected item |
dataTestId | string | Prop to provide to unique data-testid |
Note: you can refer more usage here
FooterActions
The FooterActions
component is a sub component of SidePanel to render the footer actions.
Name | Type | Description |
---|---|---|
tooltipTitle | string | Prop to provide the tooltip content |
isActionMenuOpen | boolean | Prop to provide open state of action menu |
onClickButton | (isActionMenuOpen: boolean) => void | An onClick event to overwrite the icon button's onClick. |
children | ReactNode | Prop to provide the content of actions, list of FooterActionItem |
dataTestId | string | Prop to provide to unique data-testid |
FooterActionItem
The FooterActionItem
is the sub component to render list of actions in FooterActions
.
Name | Type | Description |
---|---|---|
id | string | Prop to provide id of action item |
icon | IconName | Prop to provide icon of action item |
tooltipTitle | string | Prop to provide the tooltip content when side panel is expanded |
children | ReactNode | Prop to provide the content of action item |
onClick | (id: string) => void | Prop to provide a callback to inform the id of selected item |
dataTestId | string | Prop to provide to unique data-testid |
ErrorState
A component renders a warning Badge
in the footer area.
Name | Type | Description |
---|---|---|
tooltip | string | Prop to provide the tooltip content |
Props
Name | Type | Default |
---|---|---|
children Defines the content to be displayed inside the component. |
| — |
isOpen Indicates whether the sidepanel is currently expanded. |
| — |
onToggleButtonClick A callback function triggered when the toggle button is clicked. |
| — |
onClickLogo A callback function that is invoked when the logo in header is clicked. |
| — |
onClickHeaderAction A callback function that executes when an action button in the header is clicked. |
| — |
headerActionTooltip Specifies the tooltip content for the header action button. |
| — |
toggleButtonTooltip Defines the content of the tooltip for the toggle button. |
| — |
footer The footer content of the component. |
| — |
isLoading Indicates if the component is in a loading state. |
| — |
dataTestId A custom identifier used for testing purposes |
| — |
data-{foo} Data attributes can be used by testing libraries to retrieve components or assert their existence |
| — |
* - the prop is required. |