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

feat: remove current edition and change cross style #1725

Merged
merged 26 commits into from
Jul 5, 2024
Merged
Show file tree
Hide file tree
Changes from 21 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
6b0b4dd
feat: remove current edition and change cross style to move it to the…
Jun 18, 2024
52a81cd
feat: change placeholder text
Jun 18, 2024
7ae2a9c
feat: merge with main
Jun 18, 2024
23faceb
feat: modify logo and close styles
Jun 19, 2024
eff85f2
feat: modify search and submit styles
Jun 24, 2024
0731137
feat: modify edition switcher style and remove logo from drawer
Jul 1, 2024
6904897
feat: update hex code
Jul 2, 2024
264441f
feat: add padding to item only inside edition switcher
Jul 2, 2024
5fb7ffc
feat: change variable value and font size only for search
Jul 2, 2024
4cf74e4
Merge branch 'main' into CON-3426-searchNavBarRedesign
danieleruiz Jul 2, 2024
2ef7186
feat: use button mixin
Jul 2, 2024
c38d48d
feat: merge with main
Jul 2, 2024
810919d
feat: change margin with spacing by name
Jul 2, 2024
d4f24cb
feat: add more padding to drawer tools and move subscribe button
Jul 2, 2024
553eff5
feat: remove border top
Jul 2, 2024
11b9077
feat: remove unnecessary styles from button
Jul 2, 2024
a93e691
feat: use o-forms styles for input and button
Jul 3, 2024
68c2f7f
feat: modify search home styles
Jul 3, 2024
256e844
chore: remove old demos
notlee Jul 3, 2024
283a167
chore: install o-footer as a peer dependency
notlee Jul 3, 2024
8449f68
feat!: Add o-header migraiton guide
notlee Jul 3, 2024
d3a27f7
Update components/o-header/src/scss/features/_drawer.scss
danieleruiz Jul 3, 2024
d1d92ef
feat: change markup insted use flex order remove logo class
Jul 3, 2024
9c2e984
feat: change markup insted use flex order remove logo class
Jul 3, 2024
aec0998
feat: fix vertical spaces and add o-forms structure to sticky search
Jul 4, 2024
03d96da
CON-3426: add extra padding only in mobile with anon links
Jul 4, 2024
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
48 changes: 28 additions & 20 deletions components/o-header/MIGRATION.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
# Migration Guide

## Migrating from v12 to v13

o-header v13 includes markup changes to the drawer. This updates the edition switcher; moves the close button to align with where the hamburger icon would be when closed; and updates the search bar both in the drawer and on desktop. To migrate:

1. Update your markup according to the [Storybook demo](https://o2-core.origami.ft.com/?path=/story/components-o-header--header-primary&globals=backgrounds:!undefined) or [use o-header's tsx template](https://github.com/Financial-Times/origami/tree/main/components/o-header/src/tsx).
2. Ensure your project uses a compatible version of o-forms. Please upgrade o-forms if you see a dependency conflict upon install.

## Migrating from v11 to v12

o-header v12 includes markup changes in the top right menu, which are included in the top.tsx template within this component. Update your markup as described below or [use o-header's tsx template](https://github.com/Financial-Times/origami/tree/main/components/o-header/src/tsx).
o-header v12 includes markup changes in the top right menu, which are included in the top.tsx template within this component. Update your markup according to the [Storybook demo](https://o2-core.origami.ft.com/?path=/story/components-o-header--header-primary&globals=backgrounds:!undefined) or [use o-header's tsx template](https://github.com/Financial-Times/origami/tree/main/components/o-header/src/tsx).

### Removal of the myFT link

Expand All @@ -26,39 +33,32 @@ The following markup can be removed all together from all header types.
In the same location of where the myFT logo link was removed we need to add a new link for accessing the users My Account or prompting them to Sign in.

```html
<a
className="o-header__top-myaccount"
href="/myaccount"
>
<a className="o-header__top-myaccount" href="/myaccount">
<span>My Account</span>
</a>
```

> [!NOTE]
> This same markup is used for both the My Account and Sign in links. Your templates will need to be responsible for swapping the anchor text within the `<span>` and the `href` value


When this is being used in the sticky header a `tabIndex` attribute should be added with a value of `-1`. This ensures that the link is not included in keyboard navigation.

```html
<a
className="o-header__top-myaccount"
href="/myaccount"
tabIndex="-1"
>
<a className="o-header__top-myaccount" href="/myaccount" tabindex="-1">
<span>My Account</span>
</a>
```


## Migrating from v10 to v11

o-header v11 includes markup changes in the drawer menu. Update your markup as described below or [use o-header's tsx template](https://github.com/Financial-Times/origami/tree/main/components/o-header/src/tsx).

In addition the `subbrand` variant has been removed, as it appears to no longer be used. Ensure there is no use of the `subbrand` variant in your project:

- Check there is no `o-header__subbrand` class reference in your markup.
- Check that the `subbrand` feature is not specifically included with the `oHeader` Sass mixin.
Remove the `subbrand` variant from your project if possible, else contact the Origami team if you still need this feature.
Remove the `subbrand` variant from your project if possible, else contact the Origami team if you still need this feature.

### Markup visual drawer headings

Update your drawer markup to semantically represent visually grouped navigation items. This approach improves the experience for users of assistive technologies.
Expand All @@ -68,28 +68,30 @@ Update your drawer markup to semantically represent visually grouped navigation
3. Associate both elements with the `aria-labelledby` attribute.

Before:

```html
<nav>
<ul>
<!-- more list items without heading -->
<!-- more list items without heading -->
</ul>
</nav>
```

After:

```html
<nav>
<h2 id="o-header-drawer-top-sections" id='top-sections'>Top sections</h2>
<h2 id="o-header-drawer-top-sections" id="top-sections">Top sections</h2>
<ul aria-labelledby="top-sections">
<!-- list items -->
<!-- list items -->
</ul>
<h2 id="o-header-drawer-top-sections" id='ft-recommends'>FT recommends</h2>
<h2 id="o-header-drawer-top-sections" id="ft-recommends">FT recommends</h2>
<ul aria-labelledby="ft-recommends">
<!-- list items -->
<!-- list items -->
</ul>
<!-- more list items without heading -->
<ul>
<!-- more list items without heading -->
<!-- more list items without heading -->
</ul>
</nav>
```
Expand Down Expand Up @@ -120,16 +122,17 @@ Update the `.o-header__drawer` element for improved accessibility:
## Migrating from v9 to v10

o-header v10 includes markup changes. Use demo markup to update your project. Changes to be aware of include:

- Deprecated markup for the old style of edition switcher has changed. The following classes no longer exist `.o-header__drawer-editions` and `.o-header__drawer-editions-link`. Check the markup of the header drawer is correct.
- Add "icon" to classes `o-header__top-link o-header__top-link--[icon]`, where `[icon]` is "menu", "search", or "myft". E.g. `o-header__top-link o-header__top-link--menu` becomes `o-header__top-icon-link o-header__top-icon-link--[icon]`.
- Add signup and subscribe links to `o-header__top-column--right`.

## Migrating from v8 to v9

v9 drops support for Bower and version 2 of the Origami Build Service.

Follow [the migration guide on the Origami website](https://origami.ft.com/documentation/tutorials/bower-to-npm/).


## Migrating from v7 to v8

v8 removes support for the internal brand. Consider using [o-header-services](https://github.com/Financial-Times/o-header-services) instead, or contact the Origami team to discuss bring back support for the internal brand.
Expand All @@ -149,6 +152,7 @@ its dependencies. See [the Bower config for these](./bower.json).
Origami components now require a `$system-code` Sass variable is set by the project, which must be a valid [Bizops system code](https://biz-ops.in.ft.com/list/Systems).

The following Sass variables have been removed:

- `$o-header-image-service-version`
- `$o-header-image-base-url`

Expand All @@ -175,6 +179,7 @@ The following Sass mixins have been removed and should be replaced with a single
- `oHeaderTransparent`: 'transparent' feature

E.g. to output the header with select features:

```diff
-@include oHeaderBase;
-@include oHeaderTop;
Expand All @@ -184,20 +189,23 @@ E.g. to output the header with select features:
```

Or to output only base styles:

```diff
-@include oHeaderBase;
-@include oHeaderTop;
+@include oHeader($opts: ());
```

Or to output only extra features without the base styles required by all features:

```diff
-@include _oHeaderDrawer;
-@include _oHeaderSticky;
+@include oHeader($opts: ('drawer', 'sticky'), $include-base-styles: false);
```

There is no direct replacement for the following mixins. Please contact the Origami team if you have a usecase for these:

- `oHeaderLink`
- `oHeaderFancyLink`
- `oHeaderItemSeparator`
Expand Down
36 changes: 18 additions & 18 deletions components/o-header/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Check out [how to include Origami components in your project](https://origami.ft

## Markup

As there are variations on the header, and the markup for each is specific and somewhat extensive, we recommend visiting the [component page](http://registry.origami.ft.com/components/o-header) in the registry to find the markup that is most suited to your product. The demo on the component page does not use real navigation data as it may become out of date. See the [Origami Navigation Service](https://www.ft.com/__origami/service/navigation) to populate `o-header` markup with real navigation data. The Origami Navigation Service is a JSON API which provides navigation structures for use across FT websites.
As there are variations on the header, and the markup for each is specific and somewhat extensive, we recommend visiting the [component page](https://o2-core.origami.ft.com/?path=/story/components-o-header--header-primary&globals=backgrounds:!undefined) in Storybook to find the markup that is most suited to your product. The demo on the component page does not use real navigation data as it may become out of date. See the [Origami Navigation Service](https://www.ft.com/__origami/service/navigation) to populate `o-header` markup with real navigation data. The Origami Navigation Service is a JSON API which provides navigation structures for use across FT websites.

_There are intentionally no classes to switch between logged in and out as we don't want to do that in the client side. This is left up to the product._

Expand All @@ -32,7 +32,6 @@ Some elements inside the header require specific data attributes so the JavaScri
- data-o-header-subnav-wrapper: Applied to the inner wrapper `div` of the subnav menu so the JS can handle the scrolling
- data-o-header-search-state: Optional, may be "open" or "close" to indicate the default visibility of the search bar.


## JavaScript

An o-header object must be constructed for every `<header>` you have on your page that uses this component.
Expand All @@ -50,14 +49,14 @@ The o-header constructor accepts an optional options object, used to control cer
```js
import oHeader from '@financial-times/o-header';
const headerEl = document.querySelector('.o-header');
const header = new oHeader(headerEl, { searchBarOpen: true });
const header = new oHeader(headerEl, {searchBarOpen: true});
```

Alternatively, a `o.DOMContentLoaded` event can be dispatched on the document to auto-construct an o-header object for each element with a `data-o-component="o-header"` attribute:

```js
import '@financial-times/o-header';
document.addEventListener("DOMContentLoaded", function() {
document.addEventListener('DOMContentLoaded', function () {
document.dispatchEvent(new CustomEvent('o.DOMContentLoaded'));
});
```
Expand All @@ -70,7 +69,6 @@ o-header fires the following events:
- `oHeader.MegaMenuClose`: When a mega menu is closed. The target of the event is the menu itself.
- `oHeader.Sticky`: When the header changes to or from sticky. The event detail will contain an `isActive` boolean indicated sticky or not. The target of the event is the menu itself.


## Sass

The header is made up of various features (e.g. `nav`, `search`, and `drawer`). To get everything, use the `oHeader()` mixin without arguments. To get only the stuff you need, you can pass in a list of options as the first argument.
Expand Down Expand Up @@ -101,19 +99,21 @@ To use `o-header` setup a [core and enhanced experience](https://origami.ft.com/

## Migration guide

State | Major Version | Last Minor Release | Migration guide |
:---: | :---: | :---: | :---:
✨ active | 11 | N/A | [migrate to v11](MIGRATION.md#migrating-from-v10-to-v11) |
⚠ maintained | 10 | N/A | [migrate to v10](MIGRATION.md#migrating-from-v9-to-v10) |
╳ deprecated | 9 | N/A | [migrate to v9](MIGRATION.md#migrating-from-v8-to-v9) |
╳ deprecated | 8 | 8.6 | [migrate to v8](MIGRATION.md#migrating-from-v7-to-v8) |
╳ deprecated | 7 | 7.8 | [migrate to v7](MIGRATION.md#migrating-from-v6-to-v7) |
╳ deprecated | 6 | 6.14 | [migrate to v6](MIGRATION.md#migrating-from-v5-to-v6) |
╳ deprecated | 5 | 5.0 | - |
╳ deprecated | 4 | 4.0 | - |
╳ deprecated | 3 | 3.0 | - |
╳ deprecated | 2 | 2.5 | - |
╳ deprecated | 1 | 1.1 | - |
| State | Major Version | Last Minor Release | Migration guide |
| :----------: | :-----------: | :----------------: | :------------------------------------------------------: |
| ✨ active | 13 | N/A | [migrate to v13](MIGRATION.md#migrating-from-v12-to-v13) |
| ⚠ maintained | 12 | N/A | [migrate to v12](MIGRATION.md#migrating-from-v11-to-v12) |
| ⚠ maintained | 11 | N/A | [migrate to v11](MIGRATION.md#migrating-from-v10-to-v11) |
| ╳ deprecated | 10 | N/A | [migrate to v10](MIGRATION.md#migrating-from-v9-to-v10) |
| ╳ deprecated | 9 | N/A | [migrate to v9](MIGRATION.md#migrating-from-v8-to-v9) |
| ╳ deprecated | 8 | 8.6 | [migrate to v8](MIGRATION.md#migrating-from-v7-to-v8) |
| ╳ deprecated | 7 | 7.8 | [migrate to v7](MIGRATION.md#migrating-from-v6-to-v7) |
| ╳ deprecated | 6 | 6.14 | [migrate to v6](MIGRATION.md#migrating-from-v5-to-v6) |
| ╳ deprecated | 5 | 5.0 | - |
| ╳ deprecated | 4 | 4.0 | - |
| ╳ deprecated | 3 | 3.0 | - |
| ╳ deprecated | 2 | 2.5 | - |
| ╳ deprecated | 1 | 1.1 | - |

## Contact

Expand Down
Loading
Loading