-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feat(web): Introduce UNSTABLE Header component #DS-1523
- Loading branch information
Showing
9 changed files
with
222 additions
and
0 deletions.
There are no files selected for viewing
121 changes: 121 additions & 0 deletions
121
packages/web/src/scss/components/UNSTABLE_Header/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
# UNSTABLE Header | ||
|
||
⚠️ This component is UNSTABLE. It may significantly change at any point in the future. | ||
Please use it with caution. | ||
|
||
The `UNSTABLE_Header` component is planned to replace the `Header` component in the future. | ||
|
||
This component provides these components: | ||
|
||
- [UNSTABLE_Header](#unstable-header) | ||
- [UNSTABLE_HeaderLogo](#unstable-headerlogo) | ||
|
||
## UNSTABLE Header | ||
|
||
The `UNSTABLE_Header` component is a main wrapper which provides mainly the visual for the Header. | ||
|
||
```html | ||
<header class="UNSTABLE_Header"> | ||
<!-- content --> | ||
</header> | ||
``` | ||
|
||
It also sets CSS variable for the Header height which can be used in other nested components. | ||
|
||
## UNSTABLE HeaderLogo | ||
|
||
The `UNSTABLE_HeaderLogo` component is a container for the logo. | ||
|
||
```html | ||
<a href="#" class="UNSTABLE_HeaderLogo"> | ||
<!-- content --> | ||
</a> | ||
``` | ||
|
||
It inherits the `UNSTABLE_Header` height and sets the logo wrapper height to the same value. | ||
|
||
You can use the `ProductLogo` component inside the `UNSTABLE_HeaderLogo` component. | ||
|
||
```html | ||
<a href="#" class="UNSTABLE_HeaderLogo"> | ||
<div class="ProductLogo"> | ||
<!-- content --> | ||
</div> | ||
</a> | ||
``` | ||
|
||
## Component Composition | ||
|
||
Use [`Container`][web-container] and [`Flex`][web-flex] components to create a layout for the Header content. | ||
|
||
```html | ||
<header class="UNSTABLE_Header"> | ||
<div class="Container"> | ||
<div class="Flex Flex--row Flex--noWrap Flex--alignmentXLeft Flex--alignmentYCenter"> | ||
<a href="#" class="UNSTABLE_HeaderLogo"> | ||
<div class="ProductLogo"> | ||
<!-- content --> | ||
</div> | ||
</a> | ||
<!-- Navigation --> | ||
<!-- Another Navigation --> | ||
</div> | ||
</div> | ||
</header> | ||
``` | ||
|
||
This way you can modify the layout of the Header content easily and modify it how you need. | ||
|
||
For example you can make the content centered by setting the `Flex` alignment classes to center. | ||
|
||
```html | ||
<header class="UNSTABLE_Header"> | ||
<div class="Flex Flex--row Flex--noWrap Flex--alignmentXCenter Flex--alignmentYCenter"> | ||
<a href="#" class="UNSTABLE_HeaderLogo"> | ||
<div class="ProductLogo"> | ||
<!-- content --> | ||
</div> | ||
</a> | ||
</div> | ||
</header> | ||
``` | ||
|
||
Or you can make modify gaps between the content by setting the `Flex` spacing styles. | ||
|
||
```html | ||
<header class="UNSTABLE_Header"> | ||
<div class="Container"> | ||
<div | ||
class="Flex Flex--row Flex--noWrap Flex--alignmentXLeft Flex--alignmentYCenter" | ||
style="--flex-spacing: var(--spirit-space-500);" | ||
> | ||
<a href="#" class="UNSTABLE_HeaderLogo"> | ||
<div class="ProductLogo"> | ||
<!-- content --> | ||
</div> | ||
</a> | ||
<!-- Navigation --> | ||
<!-- Another Navigation --> | ||
</div> | ||
</div> | ||
</header> | ||
``` | ||
|
||
If you need the whole Header fluid you can do it by adding the `Container--fluid` class to the `Container`. | ||
|
||
```html | ||
<header class="UNSTABLE_Header"> | ||
<div class="Container Container--fluid"> | ||
<div class="Flex Flex--row Flex--noWrap Flex--alignmentXLeft Flex--alignmentYCenter"> | ||
<a href="#" class="UNSTABLE_HeaderLogo"> | ||
<div class="ProductLogo"> | ||
<!-- content --> | ||
</div> | ||
</a> | ||
</div> | ||
</div> | ||
</header> | ||
``` | ||
|
||
[web-container]: https://github.com/lmc-eu/spirit-design-system/blob/main/packages/web/src/scss/components/Container/README.md | ||
[web-flex]: https://github.com/lmc-eu/spirit-design-system/blob/main/packages/web/src/scss/components/Flex/README.md |
13 changes: 13 additions & 0 deletions
13
packages/web/src/scss/components/UNSTABLE_Header/_UNSTABLE_Header.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
@use '@tokens' as tokens; | ||
@use 'theme'; | ||
|
||
.UNSTABLE_Header { | ||
--#{tokens.$css-variable-prefix}header-height: #{theme.$height}; | ||
--#{tokens.$css-variable-prefix}navigation-height: var(--#{tokens.$css-variable-prefix}header-height); | ||
|
||
flex: none; | ||
box-sizing: content-box; | ||
height: var(--#{tokens.$css-variable-prefix}header-height); | ||
border-bottom: theme.$border-width theme.$border-style theme.$border-color; | ||
background-color: theme.$background-color; | ||
} |
8 changes: 8 additions & 0 deletions
8
packages/web/src/scss/components/UNSTABLE_Header/_UNSTABLE_HeaderLogo.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
@use '@tokens' as tokens; | ||
@use 'theme'; | ||
|
||
.UNSTABLE_HeaderLogo { | ||
display: flex; | ||
align-items: center; | ||
height: var(--#{tokens.$css-variable-prefix}header-height); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
@use '@tokens' as tokens; | ||
|
||
$height: 72px; | ||
$border-width: tokens.$border-width-100; | ||
$border-style: solid; | ||
$border-color: tokens.$border-basic; | ||
$background-color: tokens.$component-header-background; |
70 changes: 70 additions & 0 deletions
70
packages/web/src/scss/components/UNSTABLE_Header/index.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
{{#> web/layout/default title="Header" parentPageName="Components" isUnstable=true }} | ||
|
||
<section class="UNSTABLE_Section"> | ||
|
||
<div class="Container"> | ||
<h2 class="docs-Heading">Minimal Header</h2> | ||
</div> | ||
|
||
<div class="docs-Stack docs-Stack--stretch"> | ||
|
||
<header class="UNSTABLE_Header"> | ||
<div class="Flex Flex--row Flex--noWrap Flex--alignmentXCenter Flex--alignmentYCenter"> | ||
<a href="#" aria-label="JobBoard homepage" class="UNSTABLE_HeaderLogo"> | ||
<div class="ProductLogo"> | ||
{{> web/assets/jobBoardLogo }} | ||
</div> | ||
</a> | ||
</div> | ||
</header> | ||
|
||
</div> | ||
</section> | ||
|
||
<section class="UNSTABLE_Section"> | ||
|
||
<div class="Container"> | ||
<h2 class="docs-Heading">Full Header</h2> | ||
</div> | ||
|
||
<div class="docs-Stack docs-Stack--stretch"> | ||
|
||
<header class="UNSTABLE_Header"> | ||
<div class="Container"> | ||
<div class="Flex Flex--row Flex--noWrap Flex--alignmentXLeft Flex--alignmentYCenter"> | ||
<a href="#" aria-label="JobBoard homepage" class="UNSTABLE_HeaderLogo"> | ||
<div class="ProductLogo"> | ||
{{> web/assets/jobBoardLogo }} | ||
</div> | ||
</a> | ||
</div> | ||
</div> | ||
</header> | ||
|
||
</div> | ||
</section> | ||
|
||
<section class="UNSTABLE_Section"> | ||
|
||
<div class="Container"> | ||
<h2 class="docs-Heading">Fluid Header</h2> | ||
</div> | ||
|
||
<div class="docs-Stack docs-Stack--stretch"> | ||
|
||
<header class="UNSTABLE_Header"> | ||
<div class="Container Container--fluid"> | ||
<div class="Flex Flex--row Flex--noWrap Flex--alignmentXLeft Flex--alignmentYCenter"> | ||
<a href="#" aria-label="JobBoard homepage" class="UNSTABLE_HeaderLogo"> | ||
<div class="ProductLogo"> | ||
{{> web/assets/jobBoardLogo }} | ||
</div> | ||
</a> | ||
</div> | ||
</div> | ||
</header> | ||
|
||
</div> | ||
</section> | ||
|
||
{{/web/layout/default }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
@forward 'UNSTABLE_Header'; | ||
@forward 'UNSTABLE_HeaderLogo'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file added
BIN
+22.8 KB
...2e/demo-components-compare.spec.ts-snapshots/unstable-header-chromium-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+328 Bytes
(100%)
tests/e2e/demo-homepages.spec.ts-snapshots/web-chromium-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.