Skip to content

Commit

Permalink
BREAKING CHANGE(web-twig): Switch Header component to v3 design tok…
Browse files Browse the repository at this point in the history
…ens #DS-1453
  • Loading branch information
adamkudrna authored and crishpeen committed Oct 1, 2024
1 parent dde541b commit 429c9e1
Show file tree
Hide file tree
Showing 18 changed files with 161 additions and 56 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@

{% block content %}

<DocsSection title="Minimal Inverted Header" stackAlignment="stretch">
{% include '@components/Header/stories/HeaderMinimalInverted.twig' %}
<DocsSection title="Minimal Header" stackAlignment="stretch">
{% include '@components/Header/stories/HeaderMinimal.twig' %}
</DocsSection>

<DocsSection title="Inverted Header with Actions" stackAlignment="stretch">
{% include '@components/Header/stories/HeaderInvertedWithActions.twig' %}
<DocsSection title="Header with Actions" stackAlignment="stretch">
{% include '@components/Header/stories/HeaderWithActions.twig' %}
</DocsSection>

<DocsSection title="Inverted Header with Actions and Header Dialog" stackAlignment="stretch">
{% include '@components/Header/stories/HeaderInvertedWithActionsAndDialog.twig' %}
<DocsSection title="Header with Actions and Header Dialog" stackAlignment="stretch">
{% include '@components/Header/stories/HeaderWithActionsAndDialog.twig' %}
</DocsSection>

<DocsSection title="Simple Inverted Header" stackAlignment="stretch">
{% include '@components/Header/stories/HeaderSimpleInverted.twig' %}
<DocsSection title="Simple Header" stackAlignment="stretch">
{% include '@components/Header/stories/HeaderSimple.twig' %}
</DocsSection>

<DocsSection title="Simple Transparent Header" stackAlignment="stretch">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<Button
aria-controls="{{ _dialogId }}"
aria-expanded="false"
color="inverted"
color="secondary"
data-spirit-target="{{ '#' ~ _dialogId }}"
data-spirit-toggle="offcanvas"
isSquare
Expand Down
22 changes: 11 additions & 11 deletions packages/web-twig/src/Resources/components/Header/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,12 @@ unless you specify a color variant.

## Color Variants

Currently, Header comes in two color variants: **transparent** (for dark
backgrounds) and **inverted** (for light backgrounds). Use the `color` property
Currently, Header comes in two color variants: **primary** and **transparent**
(for non-solid backgrounds like gradients or images). Use the `color` property
to apply the desired background color to Header.

```twig
<Header color="inverted">
<Header color="transparent">
<a href="/">
<img
src="https://www.example.com/logo.png"
Expand Down Expand Up @@ -107,10 +107,10 @@ just branding.

## API

| Name | Type | Default | Required | Description |
| ---------- | ----------------------------- | ------------- | -------- | ----------------------------------- |
| `color` | [`transparent` \| `inverted`] | `transparent` || Color variant |
| `isSimple` | `bool` | `false` || Shorter, centered version of Header |
| Name | Type | Default | Required | Description |
| ---------- | ----------------------------- | --------- | -------- | ----------------------------------- |
| `color` | \[`primary` \| `transparent`] | `primary` || Color variant |
| `isSimple` | `bool` | `false` || Shorter, centered version of Header |

On top of the API options, the components accept [additional attributes][readme-additional-attributes].
If you need more control over the styling of a component, you can use [style props][readme-style-props]
Expand Down Expand Up @@ -419,7 +419,7 @@ This is how all supported building blocks of the Header build up the complete
composition:

```twig
<Header color="inverted">
<Header>
<!-- Branding -->
<HeaderMobileActions dialogId="my-menu">
<!-- Optional mobile-only actions -->
Expand Down Expand Up @@ -463,7 +463,7 @@ And the complete Header Dialog:
<summary>Show full example code of Header with responsive navigation</summary>

```twig
<Header color="inverted">
<Header>
<a href="/" aria-label="Spirit homepage">
<img src="…" width="65" height="24" alt="Spirit" />
</a>
Expand All @@ -489,7 +489,7 @@ And the complete Header Dialog:
</HeaderDesktopActions>
<HeaderDesktopActions isAtEnd>
<ButtonLink color="primary" href="/">Sign in</ButtonLink>
<ButtonLink color="inverted" href="/">Enterprise</ButtonLink>
<ButtonLink color="secondary" href="/">Enterprise</ButtonLink>
</HeaderDesktopActions>
</Header>
Expand All @@ -516,7 +516,7 @@ And the complete Header Dialog:
</HeaderDialogActions>
<HeaderDialogActions color="secondary">
<ButtonLink color="primary" href="/">Sign in</ButtonLink>
<ButtonLink color="inverted" href="/">Enterprise</ButtonLink>
<ButtonLink color="secondary" href="/">Enterprise</ButtonLink>
</HeaderDialogActions>
</HeaderDialog>
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
</Header>

<!-- Render with all props -->
<Header color="inverted" isSimple>
<Header color="transparent" isSimple>
<a href="/" aria-label="Spirit homepage">
{% include './partials/spiritLogo.twig' %}
</a>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Header color="inverted">
<Header>
<a href="/" aria-label="Spirit homepage">
{% include './partials/spiritLogo.twig' %}
</a>
Expand All @@ -24,7 +24,7 @@
</HeaderDesktopActions>
<HeaderDesktopActions isAtEnd>
<ButtonLink color="primary" href="/">Sign in</ButtonLink>
<ButtonLink color="inverted" href="/">Enterprise</ButtonLink>
<ButtonLink color="secondary" href="/">Enterprise</ButtonLink>
</HeaderDesktopActions>
</Header>

Expand All @@ -51,6 +51,6 @@
</HeaderDialogActions>
<HeaderDialogActions color="secondary">
<ButtonLink color="primary" href="/">Sign in</ButtonLink>
<ButtonLink color="inverted" href="/">Enterprise</ButtonLink>
<ButtonLink color="secondary" href="/">Enterprise</ButtonLink>
</HeaderDialogActions>
</HeaderDialog>
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
</header>
<!-- Render with all props -->

<header class="Header Header--inverted Header--simple">
<header class="Header Header--transparent Header--simple">
<a href="/" aria-label="Spirit homepage"><img src="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNjUiIGhlaWdodD0iMjQiIHZpZXdCb3g9IjAgMCA2NSAyNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTcuMzQ4MTIgMTEuOTA2OEw0LjI2MzY3IDYuNTk5MzlDNC4zNjA2OCA2LjA4NDg2IDQuNTM1IDUuNjE1NDMgNC43ODc1IDUuMTkxOTZMNC43ODc4OCA1LjE5MTMyTDQuNzg4MjggNS4xOTA2OEM1LjIxMzM3IDQuNTAyMzUgNS44MDY4MiAzLj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gMC40MTY3OUMwLjQ1NzY5NyAwLjM2Njg3NCAwLjQ3NDgxNSAwLjMwMzA0NiAwLjUyNDc3NCAwLjI3NDIyN1oiIGZpbGw9IiM3N0E2QzAiLz4KPHBhdGggZD0iTTIuNzUzMDQgMTguNDI5OUgyLjE3NzQ5VjE5LjE2OTNIMS40Mzc1TDEuNDM3NSAxOS43NDQzSDIuMTc3NDlWMjAuNDgzN0gyLjc1MzA0VjE5Ljc0NDNIMy40OTMwNFYxOS4xNjkzTDIuNzUzMDQgMTkuMTY5M1YxOC40Mjk5WiIgZmlsbD0iIzc3QTZDMCIvPgo8L3N2Zz4K" width="65" height="24" alt="Spirit"></a>
</header>
</body>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
</head>
<body>
<div class="HeaderMobileActions">
<button aria-controls="my-menu" aria-expanded="false" data-spirit-target="#my-menu" data-spirit-toggle="offcanvas" class="Button Button--inverted Button--medium Button--square" type="button"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewbox="0 0 24 24" fill="none" id="a1fcc7134edb5d176925f0fd5ddd9d42" aria-hidden="true">
<button aria-controls="my-menu" aria-expanded="false" data-spirit-target="#my-menu" data-spirit-toggle="offcanvas" class="Button Button--secondary Button--medium Button--square" type="button"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewbox="0 0 24 24" fill="none" id="a1fcc7134edb5d176925f0fd5ddd9d42" aria-hidden="true">
<path d="M4 18H20C20.55 18 21 17.55 21 17C21 16.45 20.55 16 20 16H4C3.45 16 3 16.45 3 17C3 17.55 3.45 18 4 18ZM4 13H20C20.55 13 21 12.55 21 12C21 11.45 20.55 11 20 11H4C3.45 11 3 11.45 3 12C3 12.55 3.45 13 4 13ZM3 7C3 7.55 3.45 8 4 8H20C20.55 8 21 7.55 21 7C21 6.45 20.55 6 20 6H4C3.45 6 3 6.45 3 7Z" fill="currentColor">
</path></svg> <span class="accessibility-hidden">Menu</span></button>
</div>
<!-- Render with all props -->

<div class="HeaderMobileActions">
<span>custom content</span> <button aria-controls="my-menu" aria-expanded="false" data-spirit-target="#my-menu" data-spirit-toggle="offcanvas" class="Button Button--inverted Button--medium Button--square" type="button"><svg width="24" height="24" fill="none" viewbox="0 0 24 24" aria-hidden="true">
<span>custom content</span> <button aria-controls="my-menu" aria-expanded="false" data-spirit-target="#my-menu" data-spirit-toggle="offcanvas" class="Button Button--secondary Button--medium Button--square" type="button"><svg width="24" height="24" fill="none" viewbox="0 0 24 24" aria-hidden="true">
<use href="#a1fcc7134edb5d176925f0fd5ddd9d42">
</use></svg> <span class="accessibility-hidden">Open menu</span></button>
</div>
Expand Down
Loading

0 comments on commit 429c9e1

Please sign in to comment.