Skip to content

Commit 40663de

Browse files
committed
refactor(Rotate): reorganize type exports and improve import structure for clarity
1 parent f201884 commit 40663de

File tree

6 files changed

+19
-24
lines changed

6 files changed

+19
-24
lines changed

packages/react-components/react-motion-components-preview/library/src/atoms/rotate-atom.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { AtomMotion, PresenceDirection, motionTokens } from '@fluentui/react-motion';
2-
3-
export type Axis3D = 'x' | 'y' | 'z';
2+
import type { Axis3D } from '../components/Rotate/rotate-types';
43

54
interface RotateAtomParams {
65
direction: PresenceDirection;
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
export { Rotate } from './Rotate';
2+
export type { RotateParams, Axis3D } from './rotate-types';

packages/react-components/react-motion-components-preview/library/src/components/Rotate/rotate-types.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import type { PresenceDuration, PresenceEasing, AnimateOpacity } from '../../types';
2-
import type { Axis3D } from '../../atoms/rotate-atom';
2+
3+
export type Axis3D = 'x' | 'y' | 'z';
34

45
export type RotateParams = PresenceDuration &
56
PresenceEasing &

packages/react-components/react-motion-components-preview/library/src/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ export { Collapse, CollapseSnappy, CollapseRelaxed, CollapseDelayed } from './co
22
export { Fade, FadeSnappy, FadeRelaxed } from './components/Fade';
33
export { Scale, ScaleSnappy, ScaleRelaxed } from './components/Scale';
44
export { Slide, SlideSnappy, SlideRelaxed } from './components/Slide';
5-
export { Blur } from './components/Blur';
6-
export { Rotate } from './components/Rotate';
5+
export { Blur, type BlurParams } from './components/Blur';
6+
export { Rotate, type RotateParams, type Axis3D } from './components/Rotate';

packages/react-components/react-motion-components-preview/stories/src/Rotate/RotateCardFlip.stories.tsx

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import * as React from 'react';
22
import { makeStyles, tokens, Button, Card, Title3, Caption1, motionTokens } from '@fluentui/react-components';
3-
import { Rotate } from '@fluentui/react-motion-components-preview';
4-
import { RotateParams } from '../../../library/src/components/Rotate/rotate-types';
3+
import { Rotate, type RotateParams } from '@fluentui/react-motion-components-preview';
54

65
const useClasses = makeStyles({
76
container: {
@@ -10,6 +9,7 @@ const useClasses = makeStyles({
109
gap: tokens.spacingVerticalXL, // 20px
1110
padding: tokens.spacingVerticalXL, // 20px
1211
maxWidth: '1000px',
12+
overflow: 'hidden', // Prevent page scrollbars during 3D rotations
1313
},
1414
controls: {
1515
display: 'flex',
@@ -42,13 +42,9 @@ const useClasses = makeStyles({
4242
justifyContent: 'center',
4343
gap: tokens.spacingVerticalS,
4444
border: `2px solid ${tokens.colorNeutralStroke1}`,
45-
// Removing shadows because they are not accurate for 3D rotations
46-
boxShadow: 'none !important', // Force remove shadow with !important
47-
'&::before': {
48-
display: 'none', // Remove any pseudo-element shadows
49-
},
50-
'&::after': {
51-
display: 'none', // Remove any pseudo-element shadows
45+
backgroundColor: tokens.colorNeutralBackground1, // Override transparent background from outline appearance
46+
':hover': {
47+
backgroundColor: tokens.colorNeutralBackground1Hover, // Override transparent hover background
5248
},
5349
},
5450
patternTitle: {
@@ -71,21 +67,19 @@ const useClasses = makeStyles({
7167
},
7268
});
7369

74-
const curveSpringRelaxed = `linear(0.000 0.000%, 0.02760 1.000%, 0.05519 2.000%, 0.08279 3.000%, 0.1104 4.000%, 0.1380 5.000%, 0.1656 6.000%, 0.1932 7.000%, 0.2208 8.000%, 0.2484 9.000%, 0.2760 10.00%, 0.3036 11.00%, 0.3312 12.00%, 0.3587 13.00%, 0.3863 14.00%, 0.4139 15.00%, 0.4415 16.00%, 0.4691 17.00%, 0.4967 18.00%, 0.5243 19.00%, 0.5519 20.00%, 0.5795 21.00%, 0.6071 22.00%, 0.6347 23.00%, 0.6623 24.00%, 0.6899 25.00%, 0.7175 26.00%, 0.7451 27.00%, 0.7727 28.00%, 0.8003 29.00%, 0.8279 30.00%, 0.8555 31.00%, 0.8831 32.00%, 0.9107 33.00%, 0.9383 34.00%, 0.9659 35.00%, 0.9935 36.00%, 1.020 37.00%, 1.042 38.00%, 1.059 39.00%, 1.072 40.00%, 1.080 41.00%, 1.084 42.00%, 1.083 43.00%, 1.080 44.00%, 1.073 45.00%, 1.065 46.00%, 1.055 47.00%, 1.044 48.00%, 1.033 49.00%, 1.022 50.00%, 1.011 51.00%, 1.002 52.00%, 0.9933 53.00%, 0.9864 54.00%, 0.9809 55.00%, 0.9770 56.00%, 0.9746 57.00%, 0.9735 58.00%, 0.9736 59.00%, 0.9748 60.00%, 0.9769 61.00%, 0.9797 62.00%, 0.9829 63.00%, 0.9863 64.00%, 0.9899 65.00%, 0.9934 66.00%, 0.9967 67.00%, 0.9997 68.00%, 1.002 69.00%, 1.004 70.00%, 1.006 71.00%, 1.007 72.00%, 1.008 73.00%, 1.008 74.00%, 1.008 75.00%, 1.008 76.00%, 1.007 77.00%, 1.006 78.00%, 1.005 79.00%, 1.004 80.00%, 1.003 81.00%, 1.002 82.00%, 1.001 83.00%, 1.000 84.00%, 0.9992 85.00%, 0.9986 86.00%, 0.9980 87.00%, 0.9977 88.00%, 0.9974 89.00%, 0.9973 90.00%, 0.9974 91.00%, 0.9975 92.00%, 0.9977 93.00%, 0.9980 94.00%, 0.9983 95.00%, 0.9987 96.00%, 0.9990 97.00%, 0.9994 98.00%, 0.9997 99.00%, 1.000 100.0%)`;
70+
const curveSpringRelaxed = `linear(0.0000 0.00%, 0.9935 36.00%, 1.042 38.00%, 1.072 40.00%, 1.084 42.00%, 1.080 44.00%, 1.055 47.00%, 0.9933 53.00%, 0.9746 57.00%, 0.9797 62.00%, 1.002 69.00%, 1.008 73.00%, 1.008 76.00%, 0.9980 87.00%, 1.000 100.00%)`;
71+
72+
type RequiredRotateParams = Required<
73+
Pick<RotateParams, 'axis' | 'angle' | 'duration' | 'easing' | 'exitEasing' | 'exitDuration'>
74+
>;
7575

7676
type RotatePattern = {
7777
id: string;
7878
name: string;
7979
description: string;
8080
icon: string;
8181
color: string;
82-
axis: Required<RotateParams['axis']>;
83-
angle: Required<RotateParams['angle']>;
84-
duration: Required<RotateParams['duration']>;
85-
easing: Required<RotateParams['easing']>;
86-
exitEasing: Required<RotateParams['easing']>;
87-
exitDuration: Required<RotateParams['duration']>;
88-
};
82+
} & RequiredRotateParams;
8983

9084
const patterns: RotatePattern[] = [
9185
{
@@ -181,6 +175,7 @@ export const CardFlip = () => {
181175
animateOpacity={false}
182176
>
183177
<Card
178+
appearance="outline"
184179
className={classes.patternCard}
185180
onClick={() => togglePattern(pattern.id)}
186181
role="button"

packages/react-components/react-motion-components-preview/stories/src/Rotate/RotateDefault.stories.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@ import {
1212
motionTokens,
1313
Button,
1414
} from '@fluentui/react-components';
15-
import { Rotate } from '@fluentui/react-motion-components-preview';
16-
import { Axis3D } from '../../../library/src/atoms/rotate-atom';
15+
import { Rotate, type Axis3D } from '@fluentui/react-motion-components-preview';
1716

1817
// import description from './ExperimentsRotate.stories.md';
1918

0 commit comments

Comments
 (0)