Codemods

The American Express Design System provides a unified language for designing American Express websites and experiences. The design system provides design resources that match our coded components and are aligned with the American Express brand. Included are colors, components, icons and glyphs, type styles, and graphic assets to get you up and running quickly.

Back to All Codemods

PageLevelMessage Transform

Converts a v6 PageLevelMessage component to a v7 PageLevelNotification component.

Automatic Changes

  • Renames the import and usages of PageLevelMessage to PageLevelNotification
  • Wraps the children of PageLevelMessage in a div element
  • Renames dismissible to isDismissible
  • Renames filled to isIconFilled
  • Updates type="neutral" to type="info"
  • Updates type="warning" to type="critical"
  • Attempts to transform the deprecated theme prop to the className prop. If it cannot, deletes the theme prop.

For example:

import { PageLevelMessage } from '@americanexpress/dls-react6';

export default function Page() {

return (

<PageLevelMessage

dismissible={true}

filled={true}

type="neutral"

theme={{ color: 'red' }}

{...otherProps}

>

Page Level Message Content

</PageLevelMessage>

);

}

Transforms into:

import { PageLevelNotification } from '@americanexpress/dls-react';

export default function Page() {

return (

<PageLevelNotification

isDismissible={true}

isIconFilled={true}

type="info"

{...otherProps}

>

Page Level Message Content

</PageLevelNotification>

);

}

Manual Changes

Headings

A new prop, headingSlot, has been introduced as a consistent way of showing a heading with the notification. If you previously included a heading tag as a child of a PageLevelMessage, you should move the text for that heading into the headingSlot prop.

Actions

A new prop, actionSlot, has been introduced as a consistent way of showing actions associated with the notification. If you previously included actions (links, buttons, etc.) as children of a PageLevelMessage, you should move these elements into the actionSlot prop.

Questions?

Connect with the DLS Team on Slack or by email.

Resources

Check out additional resources.