Skip to content

Commit

Permalink
chore(motion): align naming of stories (#33354)
Browse files Browse the repository at this point in the history
  • Loading branch information
layershifter authored Nov 27, 2024
1 parent 94f7b85 commit 805932b
Show file tree
Hide file tree
Showing 33 changed files with 75 additions and 72 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
import { PlayFilled, PauseFilled } from '@fluentui/react-icons';
import * as React from 'react';

import description from './MotionArrays.stories.md';
import description from './CreateMotionComponentArrays.stories.md';

const useClasses = makeStyles({
container: {
Expand Down Expand Up @@ -90,7 +90,7 @@ const FadeFastGrowSlow = createMotionComponent([
},
]);

export const MotionArrays = () => {
export const CreateMotionComponentArrays = () => {
const classes = useClasses();

const motionRef = React.useRef<MotionImperativeRef>();
Expand Down Expand Up @@ -154,7 +154,7 @@ export const MotionArrays = () => {
);
};

MotionArrays.parameters = {
CreateMotionComponentArrays.parameters = {
docs: {
description: {
story: description,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {
createMotionComponent,
makeStyles,
type MotionComponentProps,
type MotionImperativeRef,
motionTokens,
tokens,
Expand Down Expand Up @@ -42,7 +43,7 @@ const FadeEnter = createMotionComponent({
iterations: Infinity,
});

export const CreateMotionComponentDefault = () => {
export const CreateMotionComponentDefault = (props: MotionComponentProps) => {
const classes = useClasses();
const motionRef = React.useRef<MotionImperativeRef>();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1 @@
`createMotionComponent()` is a factory function that creates a custom motion component powered by Web Animations API.

<!-- Don't allow prettier to collapse code block into single line -->
<!-- prettier-ignore -->
> **⚠️ Preview packages are considered unstable:**
> - Features and APIs may change before final release
> - Please contact us if you intend to use this in your product
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { createMotionComponent, MotionComponentProps, makeStyles, tokens } from '@fluentui/react-components';
import { createMotionComponent, makeStyles, tokens } from '@fluentui/react-components';
import * as React from 'react';

import description from './CreateMotionComponent.stories.md';
import description from './CreateMotionComponentFactory.stories.md';

const useClasses = makeStyles({
container: {
Expand Down Expand Up @@ -47,7 +47,7 @@ const DropIn = createMotionComponent({
iterations: Infinity,
});

export const CreateMotionComponent = (props: MotionComponentProps) => {
export const CreateMotionComponentFactory = () => {
const classes = useClasses();

return (
Expand All @@ -63,7 +63,7 @@ export const CreateMotionComponent = (props: MotionComponentProps) => {
);
};

CreateMotionComponent.parameters = {
CreateMotionComponentFactory.parameters = {
docs: {
description: {
story: description,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
} from '@fluentui/react-components';
import * as React from 'react';

import description from './MotionFunctionParams.stories.md';
import description from './CreateMotionComponentFunctionParams.stories.md';

const useClasses = makeStyles({
container: {
Expand Down Expand Up @@ -84,7 +84,7 @@ const Scale = createMotionComponent<{ startFrom?: number }>(({ startFrom = 0.5 }
};
});

export const MotionFunctionParams = () => {
export const CreateMotionComponentFunctionParams = () => {
const classes = useClasses();

const motionBRef = React.useRef<MotionImperativeRef>();
Expand Down Expand Up @@ -142,7 +142,7 @@ export const MotionFunctionParams = () => {
);
};

MotionFunctionParams.parameters = {
CreateMotionComponentFunctionParams.parameters = {
docs: {
description: {
story: description,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
} from '@fluentui/react-components';
import * as React from 'react';

import description from './MotionFunctions.stories.md';
import description from './CreateMotionComponentFunctions.stories.md';

const useClasses = makeStyles({
container: {
Expand Down Expand Up @@ -70,7 +70,7 @@ const Grow = createMotionComponent(({ element }) => ({
iterations: Infinity,
}));

export const MotionFunctions = () => {
export const CreateMotionComponentFunctions = () => {
const classes = useClasses();

const motionRef = React.useRef<MotionImperativeRef>();
Expand Down Expand Up @@ -122,7 +122,7 @@ export const MotionFunctions = () => {
);
};

MotionFunctions.parameters = {
CreateMotionComponentFunctions.parameters = {
docs: {
description: {
story: description,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
import { PlayFilled, PauseFilled } from '@fluentui/react-icons';
import * as React from 'react';

import description from './ImperativeRefPlayState.stories.md';
import description from './CreateMotionComponentImperativeRefPlayState.stories.md';

const useClasses = makeStyles({
container: {
Expand Down Expand Up @@ -68,7 +68,7 @@ const FadeEnter = createMotionComponent({
iterations: Infinity,
});

export const ImperativeRefPlayState = () => {
export const CreateMotionComponentImperativeRefPlayState = () => {
const classes = useClasses();
const motionRef = React.useRef<MotionImperativeRef>();

Expand Down Expand Up @@ -130,7 +130,7 @@ export const ImperativeRefPlayState = () => {
);
};

ImperativeRefPlayState.parameters = {
CreateMotionComponentImperativeRefPlayState.parameters = {
docs: {
description: {
story: description,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
A React component created with `createMotionComponent` has the following lifecycle callbacks:
A React component created with `createMotionComponent()` has the following lifecycle callbacks:

- `onMotionStart` \- This is called when any motion has started
- `onMotionFinish` \- This is called when all motions have finished
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
import { ReplayFilled } from '@fluentui/react-icons';
import * as React from 'react';

import description from './MotionLifecycleCallbacks.stories.md';
import description from './CreateMotionComponentLifecycleCallbacks.stories.md';

const useClasses = makeStyles({
container: {
Expand Down Expand Up @@ -93,7 +93,7 @@ const FadeEnter = createMotionComponent({
duration: motionTokens.durationSlow,
});

export const MotionLifecycleCallbacks = () => {
export const CreateMotionComponentLifecycleCallbacks = () => {
const classes = useClasses();
const logLabelId = useId();

Expand Down Expand Up @@ -174,7 +174,7 @@ export const MotionLifecycleCallbacks = () => {
);
};

MotionLifecycleCallbacks.parameters = {
CreateMotionComponentLifecycleCallbacks.parameters = {
docs: {
description: {
story: description,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { createMotionComponent, makeStyles, tokens } from '@fluentui/react-components';
import * as React from 'react';

import description from './TokensUsage.stories.md';
import description from './CreateMotionComponentTokensUsage.stories.md';

const useClasses = makeStyles({
container: {
Expand Down Expand Up @@ -47,7 +47,7 @@ const BackgroundChange = createMotionComponent({
iterations: Infinity,
});

export const TokensUsage = () => {
export const CreateMotionComponentTokensUsage = () => {
const classes = useClasses();

return (
Expand All @@ -63,7 +63,7 @@ export const TokensUsage = () => {
);
};

TokensUsage.parameters = {
CreateMotionComponentTokensUsage.parameters = {
docs: {
description: {
story: description,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
import type { Meta } from '@storybook/react';
import CreateMotionComponentDescription from './CreateMotionComponentDescription.md';
import { CreateMotionComponent } from './CreateMotionComponent.stories';
import { CreateMotionComponentDefault } from './CreateMotionComponentDefault.stories';

export { CreateMotionComponentDefault as Default } from './CreateMotionComponentDefault.stories';

export { CreateMotionComponent as createMotionComponent } from './CreateMotionComponent.stories';
export { CreateMotionComponentFactory as createMotionComponent } from './CreateMotionComponentFactory.stories';

export { ImperativeRefPlayState as imperativeRef } from './ImperativeRefPlayState.stories';
export { TokensUsage as tokens } from './TokensUsage.stories';
export { CreateMotionComponentImperativeRefPlayState as imperativeRef } from './CreateMotionComponentImperativeRefPlayState.stories';
export { CreateMotionComponentTokensUsage as tokens } from './CreateMotionComponentTokensUsage.stories';

export { MotionLifecycleCallbacks as LifecycleCallbacks } from './MotionLifecycleCallbacks.stories';
export { MotionArrays as arrays } from './MotionArrays.stories';
export { MotionFunctions as functions } from './MotionFunctions.stories';
export { MotionFunctionParams as functionParams } from './MotionFunctionParams.stories';
export { CreateMotionComponentLifecycleCallbacks as LifecycleCallbacks } from './CreateMotionComponentLifecycleCallbacks.stories';
export { CreateMotionComponentArrays as arrays } from './CreateMotionComponentArrays.stories';
export { CreateMotionComponentFunctions as functions } from './CreateMotionComponentFunctions.stories';
export { CreateMotionComponentFunctionParams as functionParams } from './CreateMotionComponentFunctionParams.stories';

export default {
title: 'Motion/APIs/createMotionComponent',
component: CreateMotionComponent,
component: CreateMotionComponentDefault,
parameters: {
docs: {
description: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
} from '@fluentui/react-components';
import * as React from 'react';

import description from './PresenceAppear.stories.md';
import description from './CreatePresenceComponentAppear.stories.md';

const useClasses = makeStyles({
container: {
Expand Down Expand Up @@ -72,7 +72,7 @@ const Fade = createPresenceComponent({
},
});

export const PresenceAppear = () => {
export const CreatePresenceComponentAppear = () => {
const classes = useClasses();
const motionRef = React.useRef<MotionImperativeRef>();

Expand Down Expand Up @@ -124,7 +124,7 @@ export const PresenceAppear = () => {
);
};

PresenceAppear.parameters = {
CreatePresenceComponentAppear.parameters = {
docs: {
description: {
story: description,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
} from '@fluentui/react-components';
import * as React from 'react';

import description from './PresenceMotionArrays.stories.md';
import description from './CreatePresenceComponentArrays.stories.md';

const useClasses = makeStyles({
container: {
Expand Down Expand Up @@ -95,7 +95,7 @@ const FastFadeSlowScale = createPresenceComponent({
},
});

export const PresenceMotionArrays = () => {
export const CreatePresenceComponentArrays = () => {
const classes = useClasses();

const motionRef = React.useRef<MotionImperativeRef>();
Expand Down Expand Up @@ -148,7 +148,7 @@ export const PresenceMotionArrays = () => {
);
};

PresenceMotionArrays.parameters = {
CreatePresenceComponentArrays.parameters = {
docs: {
description: {
story: description,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
import { createPresenceComponent, Field, makeStyles, motionTokens, tokens, Switch } from '@fluentui/react-components';
import {
createPresenceComponent,
Field,
makeStyles,
motionTokens,
tokens,
Switch,
PresenceComponentProps,
} from '@fluentui/react-components';
import * as React from 'react';

const useClasses = makeStyles({
Expand Down Expand Up @@ -55,7 +63,7 @@ const Fade = createPresenceComponent({
},
});

export const CreatePresenceComponentDefault = () => {
export const CreatePresenceComponentDefault = (props: PresenceComponentProps) => {
const classes = useClasses();
const [visible, setVisible] = React.useState<boolean>(false);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,12 @@ import {
Field,
makeStyles,
type MotionImperativeRef,
PresenceComponentProps,
tokens,
Switch,
} from '@fluentui/react-components';
import * as React from 'react';

import description from './CreatePresenceComponent.stories.md';
import description from './CreatePresenceComponentFactory.stories.md';

const useClasses = makeStyles({
container: {
Expand Down Expand Up @@ -68,7 +67,7 @@ const DropIn = createPresenceComponent({
},
});

export const CreatePresenceComponent = (props: PresenceComponentProps) => {
export const CreatePresenceComponentFactory = () => {
const classes = useClasses();

const motionRef = React.useRef<MotionImperativeRef>();
Expand All @@ -91,7 +90,7 @@ export const CreatePresenceComponent = (props: PresenceComponentProps) => {
);
};

CreatePresenceComponent.parameters = {
CreatePresenceComponentFactory.parameters = {
docs: {
description: {
story: description,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
} from '@fluentui/react-components';
import * as React from 'react';

import description from './PresenceMotionFunctionParams.stories.md';
import description from './CreatePresenceComponentFunctionParams.stories.md';

const useClasses = makeStyles({
container: {
Expand Down Expand Up @@ -91,7 +91,7 @@ const Scale = createPresenceComponent<{ startFrom?: number }>(({ startFrom = 0.5
};
});

export const PresenceMotionFunctionParams = () => {
export const CreatePresenceComponentFunctionParams = () => {
const classes = useClasses();

const motionBRef = React.useRef<MotionImperativeRef>();
Expand Down Expand Up @@ -152,7 +152,7 @@ export const PresenceMotionFunctionParams = () => {
);
};

PresenceMotionFunctionParams.parameters = {
CreatePresenceComponentFunctionParams.parameters = {
docs: {
description: {
story: description,
Expand Down
Loading

0 comments on commit 805932b

Please sign in to comment.