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

fix(documentation): fix itranet and internet header docs pages #3224

Merged
merged 6 commits into from
Jul 17, 2024
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { ArgTypes, Meta, Source } from '@storybook/blocks';
import { PostTabHeader, PostTabPanel, PostTabs } from '@swisspost/design-system-components-react';
import * as IntranetHeaderStories from './intranet-header.stories';
import SampleUse from './intranet-header-use.sample?raw';
import SampleNavigationBar from './intranet-header-navigation-bar.sample.html?raw';
import SampleSideNavigation from './intranet-header-side-navigation.sample.html?raw';
import SampleSideUserMenuDropdown from './intranet-header-user-menu-dropdown.sample.html?raw';
Expand All @@ -27,66 +26,7 @@ import PostComponentDemoLink from '@/shared/post-component-demo-link.mdx';

The Header Angular component for internal usage.

<ul>
<li>
<a href="#installation" target="_self">Installation</a>
</li>
<li>
<a href="#usage" target="_self">Usage</a>
</li>
<li>
<a href="#examples" target="_self">Examples</a>
</li>
</ul>

## Installation

See <a href="/?path=/docs/7068be42-1a20-4a34-9e79-7fb7f9f2940f--docs">Intranet-header package page</a>

## Usage

1. In `app.module.ts`, import `SwissPostIntranetHeaderModule` and add it to the `imports` array property.

<Source code={SampleUse} language="typescript" />

2. In `app.component.html`, create a `section` container and assign it the CSS classes that best suit your desired layout:

<div className="table-responsive">
<table className="table">
<thead>
<tr>
<th>Class</th>
<th>Condition</th>
</tr>
</thead>
<tbody>
<tr>
<td>`layout-container`</td>
<td>Always</td>
</tr>
<tr>
<td>`header-big`</td>
<td>To use the header with a navigation bar</td>
</tr>
<tr>
<td>`header-small`</td>
<td>To use the header without a navigation bar</td>
</tr>
<tr>
<td>`with-searchbar`</td>
<td>To use the header with a search bar</td>
</tr>
</tbody>
</table>
</div>

3. In the layout container, add the `post-intranet-header` component and configure it as needed using the properties described below.

4. Add any other content in the container below the header, wrapped in an element with class `header-margin`.

### Props

<ArgTypes of={IntranetHeaderStories} />
For installation and usage see the <a href="/?path=/docs/7068be42-1a20-4a34-9e79-7fb7f9f2940f--docs">intranet-header package getting started page</a>

## Examples

Expand All @@ -111,3 +51,7 @@ See <a href="/?path=/docs/7068be42-1a20-4a34-9e79-7fb7f9f2940f--docs">Intranet-h
<Source code={SamplePostweb} language="html" />
</PostTabPanel>
</PostTabs>

### Props

<ArgTypes of={IntranetHeaderStories} />
Original file line number Diff line number Diff line change
Expand Up @@ -21,30 +21,31 @@ import { SourceDarkMode } from '@/../.storybook/preview';
The header for client-facing applications.

<ul>
<li><a href="#preparation" target="_self">Preparation</a></li>
<li><a href="#installation" target="_self">Installation</a></li>
<li><a href="#css-variables" target="_self">CSS Variables</a></li>
<li><a href="#usage-with-angular" target="_self">Usage with Angular</a></li>
<li><a href="#migration-from-the-old-header" target="_self">Migration from the old header</a></li>
</ul>

## Preparation
<div class="card my-bigger-big">
<div class="card-body">
<h5 class="card-title">Request a configuration</h5>

### Request a configuration
<p class="card-text">The Internet Header is built to support the already existing Portal Configuration used for the old Internet Header.
<br/>If you're working on a new project, you probably need a new configuration. Please contact the Post Portal Team.</p>

The Internet Header is built to support the already existing Portal Configuration used for the old Internet Header.
<a className="mb-small-r btn-primary btn"
href="mailto:[email protected]"
rel="noopener">Contact Post Portal Team <post-icon name="1001" className="fs-large" /></a>

If you're working on a new project, you probably need a new configuration. Please click the button below.

<a
className="mb-small-r btn-primary btn"
href="mailto:[email protected]"
rel="noopener"
>Contact Post Portal Team <post-icon name="1001" className="fs-large" /></a>

Not every Online Service has configurations for all environments.
<div className="alert alert-info alert-md">
<p>Not every Online Service has configurations for all environments.
For example, "TOPOS" only has `int02` configured and cannot use `int01` as value for environment.
If you are not sure what's configured for your project, please reach out to the post-portal team as well.
If you are not sure what's configured for your project, please reach out to the post-portal team as well.</p>
</div>
</div>
</div>

## Installation

### Choose between lazy-loaded or bare component version

Expand All @@ -53,53 +54,57 @@ Internet-header package provide two versions:
- Lazy-loaded (default): it allows better performance by dynamically load the component when used, so it reduces bundle size, startup time and first paint.
- Bare component: if you already manage the lazy-loading or don't need it for any reason, you can use the component without any overhead.

## Installation

### Install with a bundler

All the popular frameworks come with some form of bundler.
This makes it easy to use npm packages like the Internet Header as you can import,
bundle and deliver the header with your own code.

When working with Angular or any other framework, the easiest installation method is via npm.

<Source code={`npm install @swisspost/internet-header`} dark={SourceDarkMode} language="bash" />

<Source code={SampleFrameworks} dark={SourceDarkMode} language="html" />

<PostTabs>
<PostTabHeader slot="tabs" panel="lazy-loaded">Lazy-Loaded</PostTabHeader>
<PostTabPanel name="lazy-loaded">
<Source code={SampleLazyLoaded} dark={SourceDarkMode} language="javascript" />
<PostTabHeader slot="tabs" panel="with-bundler">Install with a bundler</PostTabHeader>
<PostTabPanel name="with-bundler">
All the popular frameworks come with some form of bundler.
This makes it easy to use npm packages like the Internet Header as you can import,
bundle and deliver the header with your own code.

When working with Angular or any other framework, the easiest installation method is via npm.

<Source code={`npm install @swisspost/internet-header`} dark={SourceDarkMode} language="bash" />

<Source code={SampleFrameworks} dark={SourceDarkMode} language="html" />

<div>
<div class="row mb-2">
<div class="col-6 fw-bold">Lazy-Loaded</div>
<div class="col-6 fw-bold">Bare Component</div>
</div>
<div class="row">
<div class="col-6"><Source code={SampleLazyLoaded} dark={SourceDarkMode} language="javascript" /></div>
<div class="col-6"><Source code={SampleBareComponent} dark={SourceDarkMode} language="javascript" /></div>
</div>
</div>
</PostTabPanel>

<PostTabHeader slot="tabs" panel="bareComponent">Bare Component</PostTabHeader>
<PostTabPanel name="bareComponent">
<Source code={SampleBareComponent} dark={SourceDarkMode} language="javascript" />
<PostTabHeader slot="tabs" panel="with-cdn">Include from a CDN</PostTabHeader>
<PostTabPanel name="with-cdn">
If you are not using any bundler or don't want to install from npm, you can load the `internet-header` from your favourite [CDN](https://en.wikipedia.org/wiki/Content_delivery_network).<br/>
Make sure to replace `{version}` with the version you want to use or remove `@{version}` to use the latest version.

Available CDNs:

- [jsDelivr](https://www.jsdelivr.com/): replace `{cdnURL}` with [https://cdn.jsdelivr.net/npm/@swisspost/internet-header](https://cdn.jsdelivr.net/npm/@swisspost/internet-header).
- [unpkg](https://unpkg.com/): replace `{cdnURL}` with [https://unpkg.com/@swisspost/internet-header](https://unpkg.com/@swisspost/internet-header).

<div>
<div class="row mb-2">
<div class="col-6 fw-bold">Lazy-Loaded</div>
<div class="col-6 fw-bold">Bare Component</div>
</div>
<div class="row">
<div class="col-6"><Source code={SampleCDNLazyLoaded} dark={SourceDarkMode} language="html" /></div>
<div class="col-6"><Source code={SampleCDNBareComponent} dark={SourceDarkMode} language="html" /></div>
</div>
</div>
</PostTabPanel>
</PostTabs>

### Include from a CDN

If you are not using any bundler or don't want to install from npm, you can load the `internet-header` from your favourite [CDN](https://en.wikipedia.org/wiki/Content_delivery_network).<br/>
Make sure to replace `{version}` with the version you want to use or remove `@{version}` to use the latest version.
### Usage with Angular

Available CDNs:

- [jsDelivr](https://www.jsdelivr.com/): replace `{cdnURL}` with [https://cdn.jsdelivr.net/npm/@swisspost/internet-header](https://cdn.jsdelivr.net/npm/@swisspost/internet-header).
- [unpkg](https://unpkg.com/): replace `{cdnURL}` with [https://unpkg.com/@swisspost/internet-header](https://unpkg.com/@swisspost/internet-header).

<PostTabs>
<PostTabHeader slot="tabs" panel="lazy-loaded">Lazy-Loaded</PostTabHeader>
<PostTabPanel name="lazy-loaded">
<Source code={SampleCDNLazyLoaded} dark={SourceDarkMode} language="html" />
</PostTabPanel>

<PostTabHeader slot="tabs" panel="bareComponent">Bare Component</PostTabHeader>
<PostTabPanel name="bareComponent">
<Source code={SampleCDNBareComponent} dark={SourceDarkMode} language="html" />
</PostTabPanel>
</PostTabs>
For Angular user, please have a look at [How to integrate Web Components inside Angular](/?path=/docs/8426deb2-3d6d-4fcc-90e6-1ca9737b2ed0--docs#usage-of-web-components)

## CSS Variables

Expand All @@ -117,10 +122,6 @@ This stylesheet allows you to access CSS variables to implement styling relative
</PostTabPanel>
</PostTabs>

## Usage with Angular

For Angular user, please have a look at [How to integrate Web Components inside Angular](/?path=/docs/8426deb2-3d6d-4fcc-90e6-1ca9737b2ed0--docs#usage-of-web-components)

## Migration from the old header

This guide aims to give a broad overview of how a migration can be performed.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Meta, Source } from '@storybook/blocks';
import * as IntranetHeaderStories from './intranet-header.stories';
import SampleUse from './intranet-header-use.sample?raw';

<Meta of={IntranetHeaderStories} />

Expand All @@ -15,18 +16,47 @@ import * as IntranetHeaderStories from './intranet-header.stories';

The Header Angular component for internal usage.

<ul>
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you remove the navigation for other packages as well?

<li>
<a href="#installation" target="_self">Installation</a>
</li>
<li>
<a href="#usage" target="_self">Usage</a>
</li>
<li>
<a href="#examples" target="_self">Examples</a>
</li>
</ul>

## Installation

<Source code={`npm install @swisspost/design-system-intranet-header`} language="bash" />

## Usage

1. In `app.module.ts`, import `SwissPostIntranetHeaderModule` and add it to the `imports` array property.

<Source code={SampleUse} language="typescript" />

2. In `app.component.html`, create a `section` container and assign it the CSS classes that best suit your desired layout:

<div className="table-responsive">
<table className="table">
<thead>
<tr>
<th>Class</th>
<th>Condition</th>
</tr>
</thead>
<tbody>
<tr>
<td>`layout-container`</td>
<td>Always</td>
</tr>
<tr>
<td>`header-big`</td>
<td>To use the header with a navigation bar</td>
</tr>
<tr>
<td>`header-small`</td>
<td>To use the header without a navigation bar</td>
</tr>
<tr>
<td>`with-searchbar`</td>
<td>To use the header with a search bar</td>
</tr>
</tbody>
</table>
</div>

3. In the layout container, add the `post-intranet-header` component and configure it as needed using the properties described below.

4. Add any other content in the container below the header, wrapped in an element with class `header-margin`.
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,6 @@ import SampleVariable from './styles-variable.sample.scss?raw';

The styling package, including theming for [Bootstrap](https://getbootstrap.com/) and [ng-bootstrap](https://ng-bootstrap.github.io/#/home) components.

<ul>
<li>
<a href="#installation" target="_self">Installation</a>
</li>
<li>
<a href="#usage" target="_self">Usage</a>
</li>
</ul>

## Installation

<Source code={`npm install @swisspost/design-system-styles`} language="bash" />
Expand Down