11import * as React from 'react' ;
2- import { Button , makeStyles , mergeClasses , shorthands , tokens } from '@fluentui/react-components' ;
2+ import { Button , makeStyles , mergeClasses , shorthands /* tokens */ } from '@fluentui/react-components' ;
33import { Dismiss24Regular } from '@fluentui/react-icons' ;
4- import { useMotionClassNames , useMotion } from '@fluentui/react-motion-preview' ;
4+ // import { useMotionClassNames, useMotion } from '@fluentui/react-motion-preview';
55import { DrawerBody , DrawerHeader , DrawerHeaderTitle , InlineDrawer } from '@fluentui/react-drawer' ;
66
7- const visibleKeyframe = {
8- ...shorthands . borderRadius ( 0 ) ,
9- opacity : 1 ,
10- transform : 'translate3D(0, 0, 0)' ,
11- } ;
7+ /**
8+ * TODO: The contents of this file should be uncommented when react-motion is stable.
9+ * Note that this file is not included in the documentation, but we can keep it here for use in the future.
10+ */
1211
13- const hiddenKeyframe = {
14- ...shorthands . borderRadius ( '36px' ) ,
15- opacity : 0 ,
16- transform : 'translate3D(-100%, 0, 0)' ,
17- } ;
12+ // const visibleKeyframe = {
13+ // ...shorthands.borderRadius(0),
14+ // opacity: 1,
15+ // transform: 'translate3D(0, 0, 0)',
16+ // };
17+
18+ // const hiddenKeyframe = {
19+ // ...shorthands.borderRadius('36px'),
20+ // opacity: 0,
21+ // transform: 'translate3D(-100%, 0, 0)',
22+ // };
1823
1924const useStyles = makeStyles ( {
2025 root : {
@@ -42,68 +47,68 @@ const useStyles = makeStyles({
4247 } ,
4348} ) ;
4449
45- const drawerWidth = '360px' ;
46-
47- const useDrawerMotionStyles = makeStyles ( {
48- default : {
49- width : drawerWidth ,
50- willChange : 'opacity, transform, border-radius' ,
51- } ,
52-
53- enter : {
54- animationDuration : tokens . durationGentle ,
55- animationTimingFunction : tokens . curveDecelerateMid ,
56- animationName : {
57- from : hiddenKeyframe ,
58- to : visibleKeyframe ,
59- } ,
60- } ,
61-
62- exit : {
63- transitionDuration : tokens . durationSlower ,
64- animationTimingFunction : tokens . curveAccelerateMin ,
65- animationName : {
66- from : visibleKeyframe ,
67- to : hiddenKeyframe ,
68- } ,
69- } ,
70- } ) ;
71-
72- const useContentMotionStyles = makeStyles ( {
73- default : {
74- transitionProperty : 'transform, background-color' ,
75- willChange : 'transform, background-color' ,
76- } ,
77-
78- enter : {
79- transitionDuration : tokens . durationSlower ,
80- transitionTimingFunction : tokens . curveDecelerateMid ,
81- transform : `translate3D(${ drawerWidth } , 0, 0)` ,
82- backgroundColor : tokens . colorNeutralBackground4 ,
83- } ,
84-
85- exit : {
86- transitionDuration : tokens . durationGentle ,
87- transitionTimingFunction : tokens . curveAccelerateMin ,
88- backgroundColor : tokens . colorNeutralBackground1 ,
89- } ,
90-
91- idle : {
92- width : `calc(100% - ${ drawerWidth } )` ,
93- } ,
94- } ) ;
50+ // const drawerWidth = '360px';
51+
52+ // const useDrawerMotionStyles = makeStyles({
53+ // default: {
54+ // width: drawerWidth,
55+ // willChange: 'opacity, transform, border-radius',
56+ // },
57+
58+ // enter: {
59+ // animationDuration: tokens.durationGentle,
60+ // animationTimingFunction: tokens.curveDecelerateMid,
61+ // animationName: {
62+ // from: hiddenKeyframe,
63+ // to: visibleKeyframe,
64+ // },
65+ // },
66+
67+ // exit: {
68+ // transitionDuration: tokens.durationSlower,
69+ // animationTimingFunction: tokens.curveAccelerateMin,
70+ // animationName: {
71+ // from: visibleKeyframe,
72+ // to: hiddenKeyframe,
73+ // },
74+ // },
75+ // });
76+
77+ // const useContentMotionStyles = makeStyles({
78+ // default: {
79+ // transitionProperty: 'transform, background-color',
80+ // willChange: 'transform, background-color',
81+ // },
82+
83+ // enter: {
84+ // transitionDuration: tokens.durationSlower,
85+ // transitionTimingFunction: tokens.curveDecelerateMid,
86+ // transform: `translate3D(${drawerWidth}, 0, 0)`,
87+ // backgroundColor: tokens.colorNeutralBackground4,
88+ // },
89+
90+ // exit: {
91+ // transitionDuration: tokens.durationGentle,
92+ // transitionTimingFunction: tokens.curveAccelerateMin,
93+ // backgroundColor: tokens.colorNeutralBackground1,
94+ // },
95+
96+ // idle: {
97+ // width: `calc(100% - ${drawerWidth})`,
98+ // },
99+ // });
95100
96101export const MotionCustom = ( ) => {
97102 const styles = useStyles ( ) ;
98103
99104 const [ open , setOpen ] = React . useState ( false ) ;
100- const motion = useMotion < HTMLDivElement > ( open ) ;
101- const drawerMotionClassNames = useMotionClassNames ( motion , useDrawerMotionStyles ( ) ) ;
102- const contentMotionClassNames = useMotionClassNames ( motion , useContentMotionStyles ( ) ) ;
105+ // const motion = useMotion<HTMLDivElement>(open);
106+ // const drawerMotionClassNames = useMotionClassNames(motion, useDrawerMotionStyles());
107+ // const contentMotionClassNames = useMotionClassNames(motion, useContentMotionStyles());
103108
104109 return (
105110 < div className = { styles . root } >
106- < InlineDrawer separator open = { motion } className = { drawerMotionClassNames } >
111+ < InlineDrawer separator /* open={motion} className={drawerMotionClassNames} */ >
107112 < DrawerHeader >
108113 < DrawerHeaderTitle
109114 action = {
@@ -124,7 +129,7 @@ export const MotionCustom = () => {
124129 </ DrawerBody >
125130 </ InlineDrawer >
126131
127- < div className = { mergeClasses ( styles . content , contentMotionClassNames ) } >
132+ < div className = { mergeClasses ( styles . content /* contentMotionClassNames */ ) } >
128133 < Button appearance = "primary" onClick = { ( ) => setOpen ( ! open ) } >
129134 { open ? 'Close' : 'Open' }
130135 </ Button >
0 commit comments