1
1
import * as React from 'react' ;
2
- import { makeStyles , tokens , Button , Card , Title3 , Caption1 , motionTokens } from '@fluentui/react-components' ;
2
+ import { makeStyles , tokens , Button , CompoundButton , motionTokens } from '@fluentui/react-components' ;
3
3
import { Rotate , type RotateParams } from '@fluentui/react-motion-components-preview' ;
4
4
5
5
const useClasses = makeStyles ( {
@@ -9,7 +9,6 @@ const useClasses = makeStyles({
9
9
gap : tokens . spacingVerticalXL , // 20px
10
10
padding : tokens . spacingVerticalXL , // 20px
11
11
maxWidth : '1000px' ,
12
- overflow : 'hidden' , // Prevent page scrollbars during 3D rotations
13
12
} ,
14
13
controls : {
15
14
display : 'flex' ,
@@ -36,24 +35,13 @@ const useClasses = makeStyles({
36
35
} ,
37
36
patternCard : {
38
37
height : '100%' ,
39
- display : 'flex' ,
40
- flexDirection : 'column' ,
41
- alignItems : 'center' ,
42
- justifyContent : 'center' ,
43
- gap : tokens . spacingVerticalS ,
38
+ width : '100%' ,
44
39
border : `2px solid ${ tokens . colorNeutralStroke1 } ` ,
45
40
backgroundColor : tokens . colorNeutralBackground1 , // Override transparent background from outline appearance
46
41
':hover' : {
47
42
backgroundColor : tokens . colorNeutralBackground1Hover , // Override transparent hover background
48
43
} ,
49
44
} ,
50
- patternTitle : {
51
- color : tokens . colorNeutralForeground1 ,
52
- } ,
53
- patternDescription : {
54
- color : tokens . colorNeutralForeground2 ,
55
- textAlign : 'center' ,
56
- } ,
57
45
demoIcon : {
58
46
width : '48px' ,
59
47
height : '48px' ,
@@ -174,26 +162,26 @@ export const CardFlip = () => {
174
162
exitDuration = { pattern . exitDuration }
175
163
animateOpacity = { false }
176
164
>
177
- < Card
165
+ < CompoundButton
178
166
appearance = "outline"
179
167
className = { classes . patternCard }
180
168
onClick = { ( ) => togglePattern ( pattern . id ) }
181
- role = "button"
182
- tabIndex = { 0 }
169
+ icon = {
170
+ < div className = { classes . demoIcon } style = { { backgroundColor : pattern . color } } >
171
+ { pattern . icon }
172
+ </ div >
173
+ }
174
+ secondaryContent = { pattern . description }
183
175
aria-label = { `Toggle ${ pattern . name } rotation` }
184
- onKeyDown = { e => {
176
+ onKeyDown = { ( e : React . KeyboardEvent ) => {
185
177
if ( e . key === 'Enter' || e . key === ' ' ) {
186
178
e . preventDefault ( ) ;
187
179
togglePattern ( pattern . id ) ;
188
180
}
189
181
} }
190
182
>
191
- < div className = { classes . demoIcon } style = { { backgroundColor : pattern . color } } >
192
- { pattern . icon }
193
- </ div >
194
- < Title3 className = { classes . patternTitle } > { pattern . name } </ Title3 >
195
- < Caption1 className = { classes . patternDescription } > { pattern . description } </ Caption1 >
196
- </ Card >
183
+ { pattern . name }
184
+ </ CompoundButton >
197
185
</ Rotate >
198
186
</ div >
199
187
) ) }
0 commit comments