Skip to content

Commit

Permalink
Docs(web-react): Introduce Migration Guide to version 3
Browse files Browse the repository at this point in the history
  • Loading branch information
crishpeen committed Oct 31, 2024
1 parent a33238b commit c58e981
Showing 1 changed file with 71 additions and 12 deletions.
83 changes: 71 additions & 12 deletions docs/migrations/web-react/MIGRATION-v3.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,20 @@ Introducing version 3 of the _spirit-web-react_ package.
## Overview

- [Component Changes](#component-changes)
- [Button and ButtonLink: `isSquare` prop](#button-and-buttonlink-issquare-prop-renamed-to-issymmetrical)
- [Heading elementType prop is now mandatory](#heading-elementtype-prop-is-now-mandatory)
- [Link `hasVisitedStyleAllowed`](#link-hasvisitedstyleallowed)
- [Link `isUnderlined`](#link-isunderlined)
- [Button and ButtonLink: `isSquare` Prop Renamed to `isSymmetrical`](#button-and-buttonlink-issquare-prop-renamed-to-issymmetrical)
- [Button and ButtonLink: Removed `inverted` Variant](#button-and-buttonlink-removed-inverted-variant)
- [Header: Removed `inverted` Variant](#header-removed-inverted-variant)
- [Heading: `elementType` Prop is Now Mandatory](#heading-elementtype-prop-is-now-mandatory)
- [Link: Removed `isUnderlined` Prop](#link-removed-isunderlined-prop)
- [Link: Removed `inverted` Variant](#link-removed-inverted-variant)
- [Link: The `hasVisitedStyleAllowed` Prop](#link-the-hasvisitedstyleallowed-prop)
- [Pill: Update Color Palette](#pill-update-color-palette)
- [ProductLogo: Removed `inverted` Variant](#productlogo-removed-inverted-variant)
- [Toast: Renamed Color Variant `inverted` to `neutral` in `ToastBar`](#toast-renamed-color-variant-inverted-to-neutral-in-toastbar)

## Component Changes

### Button and ButtonLink: `isSquare` prop renamed to `isSymmetrical`
### Button and ButtonLink: `isSquare` Prop Renamed to `isSymmetrical`

Button `isSquare` prop was renamed to `isSymmetrical`.

Expand All @@ -41,7 +47,17 @@ Manually replace the props in your project.
- `<ButtonLink isSquare … />` β†’ `<ButtonLink isSymmetrical … />`
</details>

### Heading elementType prop is now mandatory
### Button and ButtonLink: Removed `inverted` Variant

The `inverted` variant was removed from the `Button` and `ButtonLink` components.
Use themes instead to switch the color scheme.

### Header: Removed `inverted` Variant

The `inverted` variant was removed from the `Header` component. Instead the `primary` variant
was introduced. Use themes to switch the color scheme.

### Heading: `elementType` Prop is Now Mandatory

The `Heading` component previously had a default `elementType` of `"div"`.
We've removed this default to encourage developers to explicitly choose a more appropriate semantic HTML element.
Expand All @@ -67,7 +83,34 @@ Manually replace the props in your project.
- `<Heading … />` β†’ `<Heading elementType="{/* Your semantic HTML element here */}" … />`
</details>

### Link: The `hasVisitedStyleAllowed` prop was added
### Link: Removed `isUnderlined` Prop

The `isUnderlined` property was removed, please use `underlined` instead.

#### Migration Guide

πŸͺ„ Use codemods to automatically update your codebase:

```sh
npx @lmc-eu/spirit-codemods -p <path> -t v3/web-react/link-underlined-prop
```

πŸ‘‰ See [Codemods documentation][readme-codemods] for more details.

<details>
<summary>πŸ”§ Manual Migration Steps</summary>

Manually replace the props in your project.

- `<Link isUnderlined … />` β†’ `<Link underlined="always" … />`
</details>

### Link: Removed `inverted` Variant

The `inverted` variant was removed from the `Link` component.
Use themes instead to switch the color scheme.

### Link: The `hasVisitedStyleAllowed` Prop

The `hasVisitedStyleAllowed` property was added. This property allows the link to have visited state style. There is also a change in the use of the visited state style for the `Heading` component, which had previously this state set by default.
Now a prop `hasVisitedStyleAllowed` has to be added to enable the visited state.
Expand All @@ -88,26 +131,42 @@ npx @lmc-eu/spirit-codemods -p <path> -t v3/web-react/link-hasVisitedStyleAllowe
- `<Link … />` β†’ `<Link hasVisitedStyleAllowed … />`
</details>

### Link `isUnderlined`
### Pill: Update Color Palette

The `isUnderlined` property was removed, please use `underlined` instead.
The `color` prop of the `Pill` component no longer supports `primary`, `secondary`, `tertiary`, `inverted`
and `unselected` variants. Instead, the `neutral` variant was added. The current list of variants is:

- `neutral`
- `danger`
- `informative`
- `success`
- `warning`

### ProductLogo: Removed `inverted` Variant

The `inverted` variant was removed from the `ProductLogo` component.

### Toast: Renamed Color Variant `inverted` to `neutral` in `ToastBar`

The `ToastBar` `color` prop variant `inverted` was renamed to `neutral`.

#### Migration Guide

πŸͺ„ Use codemods to automatically update your codebase:

```sh
npx @lmc-eu/spirit-codemods -p <path> -t v3/web-react/link-underlined-prop
npx @lmc-eu/spirit-codemods -p <path> -t v3/web-react/toastbar-inverted-neutral
```

πŸ‘‰ See [Codemods documentation][readme-codemods] for more details.

<details>
<summary>πŸ”§ Manual Migration Steps</summary>

Manually replace the props in your project.
Manually replace the `ToastBar` prop color in your project.
Instead of using `inverted`, use `neutral`.

- `<Link isUnderlined … />` β†’ `<Link underlined="always" … />`
- `<ToastBar color="inverted" … />` β†’ `<ToastBar color="neutral" … />`
</details>

---
Expand Down

0 comments on commit c58e981

Please sign in to comment.