Skip to content

Commit

Permalink
updated header documentation. (#1646)
Browse files Browse the repository at this point in the history
Co-authored-by: Mayank <[email protected]>
  • Loading branch information
siddhantrawal and mayank99 authored Nov 16, 2023
1 parent 7347dbe commit 01104ac
Show file tree
Hide file tree
Showing 5 changed files with 180 additions and 80 deletions.
67 changes: 24 additions & 43 deletions apps/website/src/pages/docs/header.mdx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: Header
description: An overview of the CONNECT Portal headers
description: Header sits at the top of a page and is part of a consistent user experience and navigation.
layout: ./_layout.astro
propsPath: '@itwin/itwinui-react/esm/core/Header/Header.d.ts'
thumbnail: Header
Expand All @@ -14,68 +14,49 @@ import * as AllExamples from 'examples';

<p>{frontmatter.description}</p>

<Placeholder componentPageName='header' />

<LiveExample src='Header.main.tsx'>
<AllExamples.HeaderMainExample client:load />
</LiveExample>

The headers seen when in our CONNECT Portal environment. A header sits at the top of a page and is part of a consistent user experience.

## Main CONNECT Portal header

The CONNECT portal header contains the services menu, home, enterprise, assets and projects links beginning from left to right. From right to left there is the user profile, help, and notification links.
The first thing most people look at when they arrive at a new web page is the header. The header contains vital information about your company's name and function, as well as the purpose of the specific page.

Header with circular callouts, numbered from 1 to 8.
## Usage

- Services menu
- Home page
- Enterprise portal
- Assets menu
- Projects menu
- Notifications
- Help
- User icon
`Header` consists of various subcomponents and can be customized by modifying its props.

### Actions
- Logo can be added using the `appLogo` prop and specifying the desired logo under the `<HeaderLogo>` subcomponent.
- Breadcrumbs trail can be implemented using the `breadcrumbs` prop and `<HeaderBreadcrumbs>` subcomponent. Individual buttons can be added within the breadcrumbs trail using the [`<HeaderButton>` subcomponent](#headerbutton-subcomponent).
- The `actions` prop can be used to add any arbitrary buttons and content near the right end of the header.
- The `menuItems` prop can be used to show any additional actions inside an overflow menu located to the right of `actions`.

- Services menu pops up a list of services available to the user.
- Home page takes you to CONNECT Center.
- Enterprise Portal takes you to the Subscription Services Portal.
- Assets menu takes you to the assets page.
- Projects menu takes you to the ProjectWise Projects page.
- Notifications pops up your list of notifications.
- Help takes you to Bentley Communities for Bentley Cloud and Web Services.
- User profile is a drop down with options for your user profile.

## Secondary header
<LiveExample src='Header.full.tsx'>
<AllExamples.HeaderFullExample client:load />
</LiveExample>

The secondary header contains the product icon, product name, iModel name and the name of the initially opened view. On the right side of the bar is the settings menu.
### `<HeaderButton>` subcomponent

Secondary header with circular callouts, numbered from 1 to 5.
`HeaderButton` is designed to offer a range of behaviors that are dependent on the props that are passed to it.

- Product icon
- Product name
- iModel name
- View name
- Settings
- `onClick` prop: behaves like a standard button.
- `as='a'` and `href` props: behaves like a regular anchor link.
- `menuItems` prop: behaves like a dropdown button.
- Both `menuItems` and `onClick`/`href` props: behaves like a split button, where the left part is the main button/link and the right part opens a dropdown menu.

### Actions
The `isActive` prop can be used to indicate the current breadcrumb.

- Click the product name to get to the iModel Manager and display a list of iModels in the current project.
- Click the iModel name to take you to the iModel manager > iModel details page.
- Clicking on the view name will take you to the iModel index page.
- Clicking on the settings icon will open the settings menu.
## Slim Header

## Consolidated header
Make header slim using `isSlim` property. This property is helpful when the header takes too much space or when working in a 3D environment.

One of the top complaints we received was that our headers visibly takes up too much space on the screen. When the user is focusing on their work, we use the consolidated header. Additional data can be displayed based on hover and/or where you are located within the app. For example, when in a 3D working environment you’ll see the consolidated header, but when you switch to the backstage you see the normal header.
<LiveExample src='Header.slim.tsx'>
<AllExamples.HeaderSlimExample client:load />
</LiveExample>

## Accessibility

For accessibility reasons, certain users strictly use their keyboard for navigating digital interfaces. We need to ensure the header doesn’t get in the way of these users every time they want to access a page’s main content. To make their experience more efficient, include a Skip to main content link to allow keyboard users to bypass the navigation header and skip directly to the page’s content.

Without such a link, keyboard users will need to tab through the entire header every time they land on a new page. This makes their experience tedious and time-consuming. For more information, read the Skip to main content link article, and check out the Skip to main content component demo.
Without such a link, keyboard users will need to tab through the entire header every time they land on a new page. This makes their experience tedious and time-consuming. For more information, check out the `SkipToContentLink` component.

## Props

Expand Down
76 changes: 76 additions & 0 deletions examples/Header.full.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
* See LICENSE.md in the project root for license terms and full copyright notice.
*--------------------------------------------------------------------------------------------*/
import React from 'react';
import {
Header,
HeaderBreadcrumbs,
HeaderButton,
HeaderLogo,
IconButton,
MenuItem,
Avatar,
} from '@itwin/itwinui-react';
import { SvgNotification, SvgPlaceholder } from '@itwin/itwinui-icons-react';

export default () => {
const menuItems = (close: () => void) => [
<MenuItem key={1} value={'Item #1'} onClick={close}>
Item #1
</MenuItem>,
<MenuItem key={2} value={'Item #2'} onClick={close}>
Item #2
</MenuItem>,
<MenuItem key={3} value={'Item #3'} onClick={close}>
Item #3
</MenuItem>,
];

return (
<Header
appLogo={<HeaderLogo logo={<SvgPlaceholder />}>Acme</HeaderLogo>}
breadcrumbs={
<HeaderBreadcrumbs
items={[
<HeaderButton
key='project'
name='Project A'
description='YJC-2249'
onClick={() => {}}
menuItems={menuItems}
/>,
<HeaderButton
as='a'
href=''
key='iModel'
name='iModel B'
startIcon={
<img src='https://itwinplatformcdn.azureedge.net/iTwinUI/stadium.png' />
}
/>,
<HeaderButton
key='version'
name='Version C'
menuItems={menuItems}
isActive={true}
/>,
]}
/>
}
actions={[
<IconButton
key='notif'
styleType='borderless'
aria-label='View Notifications'
>
<SvgNotification />
</IconButton>,
<IconButton styleType='borderless' aria-label='View Profile'>
<Avatar abbreviation='TR' title='Terry Rivers' />
</IconButton>,
]}
menuItems={menuItems}
/>
);
};
41 changes: 4 additions & 37 deletions examples/Header.main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,40 +12,20 @@ import {
IconButton,
MenuItem,
} from '@itwin/itwinui-react';
import { SvgPlaceholder } from '@itwin/itwinui-icons-react';

export default () => {
const menuItems = (close: () => void) => [
<MenuItem key={1} value={'Item #1'} onClick={close}>
Item #1
</MenuItem>,
<MenuItem key={2} value={'Item #2'} onClick={close}>
Item #2
</MenuItem>,
<MenuItem key={3} value={'Item #3'} onClick={close}>
Item #3
</MenuItem>,
];

return (
<Header
appLogo={
<HeaderLogo
logo={
<svg viewBox='0 0 16 16' aria-hidden='true'>
<path d='m12.6 13.4c-1.2-1.5-2.1-3.1-2.4-5.5-2.7 3.9-4.6 4.2-5.7 2.4l-1.2 5.7h-2.2l3.5-14.1 1.8-.4c-.1.5-1.4 6.2.6 7 2 .7 4.6-8.5 4.6-8.5l2.2.4c-1.6 3.7-1.6 7.6 1.1 10.9l-2.3 2.1' />
</svg>
}
/>
}
appLogo={<HeaderLogo logo={<SvgPlaceholder />}>Acme</HeaderLogo>}
breadcrumbs={
<HeaderBreadcrumbs
items={[
<HeaderButton
key='project'
name='Project A (Super Size Edition)'
name='Project A'
description='YJC-2249'
onClick={() => {}}
menuItems={menuItems}
/>,
<HeaderButton
key='iModel'
Expand All @@ -55,25 +35,12 @@ export default () => {
}
onClick={() => {}}
/>,
<HeaderButton
key='version'
name='Version C'
menuItems={menuItems}
isActive={true}
/>,
]}
/>
}
actions={[
<IconButton styleType='borderless' aria-label='View profile'>
<Avatar
size='medium'
abbreviation='TR'
image={
<img src='https://itwinplatformcdn.azureedge.net/iTwinUI/user-placeholder.png' />
}
title='Terry Rivers'
/>
<Avatar abbreviation='TR' title='Terry Rivers' />
</IconButton>,
]}
/>
Expand Down
68 changes: 68 additions & 0 deletions examples/Header.slim.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
* See LICENSE.md in the project root for license terms and full copyright notice.
*--------------------------------------------------------------------------------------------*/
import * as React from 'react';
import {
Avatar,
Header,
HeaderBreadcrumbs,
HeaderButton,
HeaderLogo,
IconButton,
MenuItem,
} from '@itwin/itwinui-react';
import { SvgPlaceholder } from '@itwin/itwinui-icons-react';

export default () => {
const menuItems = (close: () => void) => [
<MenuItem key={1} value={'Item #1'} onClick={close}>
Item #1
</MenuItem>,
<MenuItem key={2} value={'Item #2'} onClick={close}>
Item #2
</MenuItem>,
<MenuItem key={3} value={'Item #3'} onClick={close}>
Item #3
</MenuItem>,
];

return (
<Header
isSlim
appLogo={<HeaderLogo logo={<SvgPlaceholder />}>Acme</HeaderLogo>}
breadcrumbs={
<HeaderBreadcrumbs
items={[
<HeaderButton
key='project'
name='Project A'
description='YJC-2249'
onClick={() => {}}
menuItems={menuItems}
/>,
<HeaderButton
key='iModel'
name='iModel B'
startIcon={
<img src='https://itwinplatformcdn.azureedge.net/iTwinUI/stadium.png' />
}
onClick={() => {}}
/>,
<HeaderButton
key='version'
name='Version C'
menuItems={menuItems}
isActive={true}
/>,
]}
/>
}
actions={[
<IconButton styleType='borderless' aria-label='View profile'>
<Avatar abbreviation='TR' title='Terry Rivers' />
</IconButton>,
]}
/>
);
};
8 changes: 8 additions & 0 deletions examples/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -610,6 +610,14 @@ import { default as HeaderMainExampleRaw } from './Header.main';
const HeaderMainExample = withThemeProvider(HeaderMainExampleRaw);
export { HeaderMainExample };

import { default as HeaderFullExampleRaw } from './Header.full';
const HeaderFullExample = withThemeProvider(HeaderFullExampleRaw);
export { HeaderFullExample };

import { default as HeaderSlimExampleRaw } from './Header.slim';
const HeaderSlimExample = withThemeProvider(HeaderSlimExampleRaw);
export { HeaderSlimExample };

// ----------------------------------------------------------------------------

import { default as InformationPanelMainExampleRaw } from './InformationPanel.main';
Expand Down

0 comments on commit 01104ac

Please sign in to comment.