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

FilterMenu Transform

Converts a v6 FilterMenu component to a v7 FilterMenu component.

Automatic Changes

  • Attempts to transform the deprecated theme prop to the className prop. If it cannot, deletes the theme prop.
  • Renames the filtersApplied prop to filtersAppliedCount.
  • Renames the onClose prop to onMenuClose.
  • Renames the onCloseClick prop to onCloseButtonClick.
  • Renames the filterButtonLabel prop to labelOverrides.filterButtonScreenReaderLabel.
  • Renames the filtersLabel prop to labelOverrides.menuHeadingLabel.
  • Renames the closeButtonLabel prop to labelOverrides.closeButtonScreenReaderLabel.
  • Renames the resetButtonLabel prop to labelOverrides.resetButtonLabel.
  • Renames the applyButtonLabel prop to labelOverrides.applyButtonLabel.

For example:

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

export default function Page() {

return (

<FilterMenu

filtersApplied={1}

onClose={() => {}}

onCloseClick={() => {}}

filterButtonLabel="Open filter menu"

filtersLabel="Filters"

closeButtonLabel="Close"

resetButtonLabel="Reset"

applyButtonLabel="Apply"

theme={{ color: 'red' }}

{...otherProps}

>

{/** Children */}

</FilterMenu>

);

}

Transforms into:

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

export default function Page() {

return (

<FilterMenu

filtersAppliedCount={1}

onMenuClose={() => {}}

onCloseButtonClick={() => {}}

labelOverrides={{

filterButtonScreenReaderLabel: 'Open filter menu',

menuHeadingLabel: 'Filters',

closeButtonScreenReaderLabel: 'Close',

resetButtonLabel: 'Reset',

applyButtonLabel: 'Apply',

}}

{...otherProps}

>

{/** Children */}

</FilterMenu>

);

}

Questions?

Connect with the DLS Team on Slack or by email.

Resources

Check out additional resources.