Skip to content

Commit

Permalink
BREAKING CHANGE(web-react): Remove align prop in ModalFooter
Browse files Browse the repository at this point in the history
  ## Migration guide

Use `alignmentX` instead of `align` prop on ModalFooter component.

- `<ModalFooter align="right" />` → `<ModalFooter alignmentX="right" />`

Please refer back to these instructions or reach out to our team
if you encounter any issues during migration.
  • Loading branch information
literat committed Jul 21, 2023
1 parent 38f0189 commit b5638ce
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 21 deletions.
16 changes: 3 additions & 13 deletions packages/web-react/src/components/Modal/ModalFooter.tsx
Original file line number Diff line number Diff line change
@@ -1,25 +1,15 @@
import React from 'react';
import classNames from 'classnames';
import { useStyleProps, useDeprecationMessage } from '../../hooks';
import { useStyleProps } from '../../hooks';
import { ModalFooterProps } from '../../types';
import { useModalStyleProps } from './useModalStyleProps';

const ModalFooter = (props: ModalFooterProps) => {
const { children, alignmentX = 'right', align = 'right', description, ...restProps } = props;
const { children, alignmentX = 'right', description, ...restProps } = props;

const { classProps } = useModalStyleProps({ footerAlignment: alignmentX || align });
const { classProps } = useModalStyleProps({ footerAlignment: alignmentX });
const { styleProps, props: otherProps } = useStyleProps(restProps);

useDeprecationMessage({
method: 'property',
trigger: !!align,
componentName: 'ModalFooter',
propertyProps: {
deprecatedName: 'align',
newName: 'alignmentX',
},
});

return (
<footer {...otherProps} {...styleProps} className={classNames(classProps.footer.root, styleProps.className)}>
{description && <div className={classProps.footer.description}>{description}</div>}
Expand Down
14 changes: 6 additions & 8 deletions packages/web-react/src/components/Modal/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,13 +103,12 @@ The rest of the properties are created from the default `<div>` element. [Docs][

**Available props**

| Name | Type | Default | Required | Description |
| ------------------ | --------------------------------------------- | --------- | -------- | ---------------------------------------------------------------------------- |
| `children` | `ReactNode` | - | no | Children node |
| `align` | [AlignmentX dictionary][dictionary-alignment] | `'right'` | no | [**DEPRECATED**][deprecated] in favor of `alignmentX`; ModalFooter alignment |
| `alignmentX` | [AlignmentX dictionary][dictionary-alignment] | `'right'` | no | ModalFooter alignment |
| `UNSAFE_className` | `string` | - | no | ModalFooter custom class name |
| `UNSAFE_style` | `CSSProperties` | - | no | ModalFooter custom style |
| Name | Type | Default | Required | Description |
| ------------------ | --------------------------------------------- | --------- | -------- | ----------------------------- |
| `children` | `ReactNode` | - | no | Children node |
| `alignmentX` | [AlignmentX dictionary][dictionary-alignment] | `'right'` | no | ModalFooter alignment |
| `UNSAFE_className` | `string` | - | no | ModalFooter custom class name |
| `UNSAFE_style` | `CSSProperties` | - | no | ModalFooter custom style |

The rest of the properties are based from type of `HTMLElement`. [Docs][HTMLElementDocs]

Expand All @@ -119,4 +118,3 @@ The rest of the properties are based from type of `HTMLElement`. [Docs][HTMLElem
[DivElementDocs]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/div
[HTMLElementDocs]: https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement
[dictionary-alignment]: https://github.com/lmc-eu/spirit-design-system/blob/main/docs/DICTIONARIES.md#alignment
[deprecated]: https://github.com/lmc-eu/spirit-design-system/tree/main/packages/web-react/README.md#deprecations

0 comments on commit b5638ce

Please sign in to comment.