1
- import { Field , makeStyles , tokens , Switch , PresenceComponentProps } from '@fluentui/react-components' ;
2
- import { Collapse } from '@fluentui/react-motion-components-preview' ;
1
+ import {
2
+ Field ,
3
+ makeStyles ,
4
+ tokens ,
5
+ Switch ,
6
+ PresenceComponentProps ,
7
+ Skeleton ,
8
+ SkeletonItem ,
9
+ } from '@fluentui/react-components' ;
10
+ import {
11
+ Blur ,
12
+ Collapse ,
13
+ CollapseDelayed ,
14
+ CollapseRelaxed ,
15
+ ScaleRelaxed ,
16
+ Slide ,
17
+ SlideRelaxed ,
18
+ } from '@fluentui/react-motion-components-preview' ;
3
19
import * as React from 'react' ;
20
+ import { PresenceStagger , Stagger } from '../Experiments/Stagger' ;
21
+ import { SlideUnder } from '../Experiments/SlideUnder' ;
22
+ import { Hold , Series } from '../Experiments/Series' ;
4
23
5
24
const useClasses = makeStyles ( {
6
25
container : {
@@ -11,6 +30,7 @@ const useClasses = makeStyles({
11
30
card : {
12
31
gridArea : 'card' ,
13
32
padding : '10px' ,
33
+ overflow : 'hidden' ,
14
34
} ,
15
35
controls : {
16
36
display : 'flex' ,
@@ -27,6 +47,28 @@ const useClasses = makeStyles({
27
47
} ,
28
48
} ) ;
29
49
50
+ const useStyles = makeStyles ( {
51
+ invertedWrapper : {
52
+ backgroundColor : tokens . colorNeutralBackground1 ,
53
+ } ,
54
+ firstRow : {
55
+ alignItems : 'center' ,
56
+ display : 'grid' ,
57
+ paddingBottom : '10px' ,
58
+ position : 'relative' ,
59
+ gap : '10px' ,
60
+ gridTemplateColumns : 'min-content 80%' ,
61
+ } ,
62
+ secondThirdRow : {
63
+ alignItems : 'center' ,
64
+ display : 'grid' ,
65
+ paddingBottom : '10px' ,
66
+ position : 'relative' ,
67
+ gap : '10px' ,
68
+ gridTemplateColumns : 'min-content 20% 20% 15% 15%' ,
69
+ } ,
70
+ } ) ;
71
+
30
72
const LoremIpsum = ( ) => (
31
73
< >
32
74
{ 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. ' . repeat (
@@ -37,8 +79,73 @@ const LoremIpsum = () => (
37
79
38
80
export const Default = ( props : React . ComponentProps < typeof Collapse > ) => {
39
81
const classes = useClasses ( ) ;
82
+ const styles = useStyles ( ) ;
83
+
40
84
const [ visible , setVisible ] = React . useState < boolean > ( false ) ;
41
85
86
+ const RowMotion = ( ) => (
87
+ < Slide . In >
88
+ < div className = { styles . firstRow } >
89
+ < SkeletonItem shape = "circle" size = { 24 } />
90
+ < SkeletonItem shape = "rectangle" size = { 16 } />
91
+ </ div >
92
+ </ Slide . In >
93
+ ) ;
94
+
95
+ const SkeletonRowCustom = ( ) => (
96
+ < div className = { styles . firstRow } >
97
+ < SkeletonItem shape = "circle" size = { 28 } />
98
+ < SkeletonItem shape = "rectangle" size = { 20 } />
99
+ </ div >
100
+ ) ;
101
+
102
+ const ContentRow = ( {
103
+ index = 0 ,
104
+ text = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.' ,
105
+ } : { index ?: number ; text ?: string } = { } ) => (
106
+ < div key = { index } className = { styles . firstRow } >
107
+ < div style = { { width : '28px' , height : '28px' , backgroundColor : 'grey' , borderRadius : '50%' } } />
108
+ < div style = { { width : '100%' , height : '28px' , paddingTop : '5px' } } > { text } </ div >
109
+ </ div >
110
+ ) ;
111
+
112
+ const ContentRowPresence = ( { visible = false } : { visible ?: boolean } ) => (
113
+ // <ScaleRelaxed visible={visible} duration={1000}>
114
+ // <div>
115
+ // <Blur visible={visible} enterDuration={700} radius="50px">
116
+ < SlideUnder visible = { visible } >
117
+ < div className = { styles . firstRow } >
118
+ { visible ? < ContentRow /> : < div style = { { width : '100%' , height : '28px' } } /> }
119
+ </ div >
120
+ </ SlideUnder >
121
+ // </Blur>
122
+ // </div>
123
+ // </ScaleRelaxed>
124
+ ) ;
125
+
126
+ const SkeletonRowPresence = ( { visible = false } : { visible ?: boolean } ) => (
127
+ // <ScaleRelaxed visible={visible} duration={1000}>
128
+ // <div>
129
+ // <Blur visible={visible} enterDuration={700} radius="50px">
130
+ < SlideUnder visible = { visible } >
131
+ { visible ? (
132
+ < div style = { { height : '36px' } } >
133
+ < Series >
134
+ < Hold duration = { 3000 } >
135
+ < SkeletonRowCustom />
136
+ </ Hold >
137
+ < Slide . In > { ContentRow ( ) } </ Slide . In >
138
+ </ Series >
139
+ </ div >
140
+ ) : (
141
+ < div style = { { width : '100%' , height : '36px' } } />
142
+ ) }
143
+ </ SlideUnder >
144
+ // </Blur>
145
+ // </div>
146
+ // </ScaleRelaxed>
147
+ ) ;
148
+
42
149
return (
43
150
< div className = { classes . container } >
44
151
< div className = { classes . controls } >
@@ -47,11 +154,24 @@ export const Default = (props: React.ComponentProps<typeof Collapse>) => {
47
154
</ Field >
48
155
</ div >
49
156
50
- < Collapse visible = { visible } >
157
+ < CollapseDelayed visible = { visible } unmountOnExit animateOpacity = { false } >
51
158
< div className = { classes . card } >
52
- < LoremIpsum />
159
+ {
160
+ < Skeleton >
161
+ < PresenceStagger delay = { 70 } mode = { visible ? 'enterReverse' : 'exitReverse' } >
162
+ < SkeletonRowPresence />
163
+ < SkeletonRowPresence />
164
+ < SkeletonRowPresence />
165
+ < SkeletonRowPresence />
166
+ < SkeletonRowPresence />
167
+ < SkeletonRowPresence />
168
+ < SkeletonRowPresence />
169
+ < SkeletonRowPresence />
170
+ </ PresenceStagger >
171
+ </ Skeleton >
172
+ }
53
173
</ div >
54
- </ Collapse >
174
+ </ CollapseDelayed >
55
175
</ div >
56
176
) ;
57
177
} ;
0 commit comments