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

Animate: Use CSS-in-JS #25754

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
Prev Previous commit
Next Next commit
Deprecate "middle" value for y-axis origin
  • Loading branch information
sarayourfriend committed Oct 2, 2020
commit 5b02810511d151cdc04154cba8227c71cd247522
12 changes: 11 additions & 1 deletion packages/components/src/animate/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
*/
import { isFunction } from 'lodash';

/**
* WordPress dependencies
*/
import deprecated from '@wordpress/deprecated';

/**
* Internal dependencies
*/
Expand All @@ -28,9 +33,14 @@ function Animate( { type, options = {}, children } ) {
const { origin = 'top' } = options;
const [ yAxis, xAxis = 'center' ] = origin.split( ' ' );

if ( yAxis === 'middle' ) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this value was used for consistency with the Popover position props but I may be wrong.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, should it be kept and still filtered out then? It does appear to line up with the Popover position props.

deprecated( 'Using "middle" for the y-axis value of origin', {
alternative: 'center',
} );
}

return (
<AppearingWrapper
// @todo(saramarcondes) deprecate "middle"
yAxis={ yAxis === 'middle' ? 'center' : yAxis }
xAxis={ xAxis }
>
Expand Down
3 changes: 3 additions & 0 deletions packages/components/src/animate/stories/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ export const appearTopRight = () => <Appear origin="top right" />;
export const appearBottomLeft = () => <Appear origin="bottom left" />;
export const appearBottomRight = () => <Appear origin="bottom right" />;
export const appearCenterCenter = () => <Appear origin="center center" />;
export const deprecatedAppearMiddleCenter = () => (
<Appear origin="middle center" />
);

export const loading = () => (
<Animate type="loading">
Expand Down