Skip to content
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

updated header documentation. #1646

Merged
merged 30 commits into from
Nov 16, 2023
Merged
Changes from 1 commit
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
0209846
updating header docs.
siddhantrawal Oct 19, 2023
3706861
Merge branch 'dev' into siddhant/update_docs_header
siddhantrawal Oct 19, 2023
8f543b3
added info to subheadings.
siddhantrawal Oct 20, 2023
02a5e8a
updated information and layout.
siddhantrawal Oct 23, 2023
dbb483a
Merge branch 'main' into siddhant/update_docs_header
siddhantrawal Oct 24, 2023
959db35
updating info inside header docs.
siddhantrawal Oct 24, 2023
b697286
updated text.
siddhantrawal Oct 25, 2023
bb7e936
Merge branch 'main' into siddhant/update_docs_header
siddhantrawal Oct 25, 2023
31b079f
updated docs and react code.
siddhantrawal Oct 25, 2023
714be06
fixing grammatical errors.
siddhantrawal Oct 25, 2023
3b52581
updated examples, text and added more info.
siddhantrawal Oct 30, 2023
7ba2cb1
removed extra import.
siddhantrawal Oct 30, 2023
dc90bd0
Merge branch 'main' into siddhant/update_docs_header
siddhantrawal Oct 30, 2023
b2c0871
update icon, text and fixed a11y violation.
siddhantrawal Oct 30, 2023
561bbf9
Merge branch 'main' into siddhant/update_docs_header
siddhantrawal Nov 1, 2023
d0d44b4
updated text and example related to comments.
siddhantrawal Nov 6, 2023
195c319
Merge branch 'siddhant/update_docs_header' of https://github.com/iTwi…
siddhantrawal Nov 6, 2023
4fc86f2
Merge branch 'main' into siddhant/update_docs_header
siddhantrawal Nov 6, 2023
ae8473c
updated backticks.
siddhantrawal Nov 6, 2023
ed689d4
removed redundant text.
siddhantrawal Nov 6, 2023
cee2d83
removed extra onClick() from example.
siddhantrawal Nov 6, 2023
c99cfad
updated header example and placement.
siddhantrawal Nov 6, 2023
5724ad7
Merge branch 'main' into siddhant/update_docs_header
siddhantrawal Nov 6, 2023
304a34b
Merge branch 'main' into siddhant/update_docs_header
siddhantrawal Nov 6, 2023
85f1bfd
Merge branch 'main' into siddhant/update_docs_header
siddhantrawal Nov 7, 2023
0eb206f
Merge branch 'main' into siddhant/update_docs_header
siddhantrawal Nov 8, 2023
648bb77
Merge branch 'main' into siddhant/update_docs_header
siddhantrawal Nov 9, 2023
b53060b
Merge branch 'main' into siddhant/update_docs_header
siddhantrawal Nov 15, 2023
460a7e8
Merge branch 'main' into siddhant/update_docs_header
siddhantrawal Nov 16, 2023
bbea3e0
Merge branch 'main' into siddhant/update_docs_header
siddhantrawal Nov 16, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 13 additions & 17 deletions apps/website/src/pages/docs/header.mdx
Original file line number Diff line number Diff line change
@@ -20,43 +20,39 @@ import * as AllExamples from 'examples';

The first thing most people look at when they arrive at a new web page is the header. It is usually stuck at the top of the page. The header contains vital information about your company's name and function, as well as the purpose of the specific page.

## Usage

The main `<header>` compnent is consisted of various subcomponents and can be customized accordingly by modifying its props.

- 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, allowing users to interact. For the dropdown menu, the `menuItems` prop can be used inside the `<HeaderButton>` for showing items and `onClick()` properties for handling actions.
- Buttons/Icons/Content can be displayed towards the left of menuitems using the `actions` prop.

## Customizations

Alter standard header section by adding new custom elements and content.

### Header with MenuItems
### Full Header

Have default header with menu items using `breadcrumbs` prop.
Have default header with additional items.

<LiveExample src='Header.menuitems.tsx'>
<LiveExample src='Header.full.tsx'>
Copy link
Member

@r100-stack r100-stack Nov 3, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we are mentioning that <HeaderButton> can be made a link (above paragraph), would be good to show it in the example too.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added, was not sure about what link to add for href, so passing empty string. Is that okay?

<AllExamples.HeaderFullExample client:load />
</LiveExample>

### Slim Header

Make header slim using `isSlim` property.
Make header slim using `isSlim` property. This can be used when working in a 3D environment.

<LiveExample src='Header.slim.tsx'>
<AllExamples.HeaderSlimExample client:load />
</LiveExample>

### Center Content

Have header with content placed in center.

<LiveExample src='Header.center.tsx'>
<AllExamples.HeaderCenterExample client:load />
</LiveExample>

## Consolidated header

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.

## 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 [article](https://www.freecodecamp.org/news/how-to-add-skip-to-main-content-links-to-a-website/), and check out the Skip to main content [component](https://itwin.github.io/iTwinUI/react/?path=/story/core-skiptocontentlink--basic).
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 article, and check out the Skip to main content component.

## Props

82 changes: 0 additions & 82 deletions examples/Header.center.tsx

This file was deleted.

File renamed without changes.
66 changes: 49 additions & 17 deletions examples/Header.main.tsx
Original file line number Diff line number Diff line change
@@ -3,12 +3,29 @@
* See LICENSE.md in the project root for license terms and full copyright notice.
*--------------------------------------------------------------------------------------------*/
import * as React from 'react';
import { action } from '@storybook/addon-actions';
import { Avatar, Header, HeaderLogo, IconButton } from '@itwin/itwinui-react';
import SvgNotification from '@itwin/itwinui-icons-react/cjs/icons/Notification';
import SvgHelpCircularHollow from '@itwin/itwinui-icons-react/cjs/icons/HelpCircularHollow';
import {
Avatar,
Header,
HeaderBreadcrumbs,
HeaderButton,
HeaderLogo,
IconButton,
MenuItem,
} from '@itwin/itwinui-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={
@@ -18,21 +35,36 @@ export default () => {
<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>
}
>
Microstation
</HeaderLogo>
/>
}
breadcrumbs={
<HeaderBreadcrumbs
items={[
<HeaderButton
key='project'
name='Project A (Super Size Edition)'
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
key='notif'
onClick={() => action('Clicked on the notification bell')()}
styleType='borderless'
>
<SvgNotification />
</IconButton>,
<IconButton styleType='borderless' aria-label='help'>
<SvgHelpCircularHollow />
</IconButton>,
<IconButton styleType='borderless' aria-label='View profile'>
<Avatar
size='medium'
27 changes: 14 additions & 13 deletions examples/Header.slim.tsx
Original file line number Diff line number Diff line change
@@ -3,7 +3,6 @@
* See LICENSE.md in the project root for license terms and full copyright notice.
*--------------------------------------------------------------------------------------------*/
import * as React from 'react';
import { action } from '@storybook/addon-actions';
import {
Avatar,
Header,
@@ -13,8 +12,6 @@ import {
IconButton,
MenuItem,
} from '@itwin/itwinui-react';
import SvgNotification from '@itwin/itwinui-icons-react/cjs/icons/Notification';
import SvgHelpCircularHollow from '@itwin/itwinui-icons-react/cjs/icons/HelpCircularHollow';

export default () => {
const menuItems = (close: () => void) => [
@@ -51,20 +48,24 @@ export default () => {
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
key='notif'
onClick={() => action('Clicked on the notification bell')()}
styleType='borderless'
>
<SvgNotification />
</IconButton>,
<IconButton styleType='borderless' aria-label='help'>
<SvgHelpCircularHollow />
</IconButton>,
<IconButton styleType='borderless' aria-label='View profile'>
<Avatar
size='medium'
6 changes: 1 addition & 5 deletions examples/index.tsx
Original file line number Diff line number Diff line change
@@ -622,18 +622,14 @@ import { default as HeaderMainExampleRaw } from './Header.main';
const HeaderMainExample = withThemeProvider(HeaderMainExampleRaw);
export { HeaderMainExample };

import { default as HeaderFullExampleRaw } from './Header.menuitems';
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 HeaderCenterExampleRaw } from './Header.center';
const HeaderCenterExample = withThemeProvider(HeaderCenterExampleRaw);
export { HeaderCenterExample };

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

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