Skip to content

Commit 6850bab

Browse files
committed
refactor(Rotate): replace Card with CompoundButton
1 parent 0b82abd commit 6850bab

File tree

2 files changed

+12
-26
lines changed

2 files changed

+12
-26
lines changed

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

Lines changed: 12 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
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';
33
import { Rotate, type RotateParams } from '@fluentui/react-motion-components-preview';
44

55
const useClasses = makeStyles({
@@ -9,7 +9,6 @@ const useClasses = makeStyles({
99
gap: tokens.spacingVerticalXL, // 20px
1010
padding: tokens.spacingVerticalXL, // 20px
1111
maxWidth: '1000px',
12-
overflow: 'hidden', // Prevent page scrollbars during 3D rotations
1312
},
1413
controls: {
1514
display: 'flex',
@@ -36,24 +35,13 @@ const useClasses = makeStyles({
3635
},
3736
patternCard: {
3837
height: '100%',
39-
display: 'flex',
40-
flexDirection: 'column',
41-
alignItems: 'center',
42-
justifyContent: 'center',
43-
gap: tokens.spacingVerticalS,
38+
width: '100%',
4439
border: `2px solid ${tokens.colorNeutralStroke1}`,
4540
backgroundColor: tokens.colorNeutralBackground1, // Override transparent background from outline appearance
4641
':hover': {
4742
backgroundColor: tokens.colorNeutralBackground1Hover, // Override transparent hover background
4843
},
4944
},
50-
patternTitle: {
51-
color: tokens.colorNeutralForeground1,
52-
},
53-
patternDescription: {
54-
color: tokens.colorNeutralForeground2,
55-
textAlign: 'center',
56-
},
5745
demoIcon: {
5846
width: '48px',
5947
height: '48px',
@@ -174,26 +162,26 @@ export const CardFlip = () => {
174162
exitDuration={pattern.exitDuration}
175163
animateOpacity={false}
176164
>
177-
<Card
165+
<CompoundButton
178166
appearance="outline"
179167
className={classes.patternCard}
180168
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}
183175
aria-label={`Toggle ${pattern.name} rotation`}
184-
onKeyDown={e => {
176+
onKeyDown={(e: React.KeyboardEvent) => {
185177
if (e.key === 'Enter' || e.key === ' ') {
186178
e.preventDefault();
187179
togglePattern(pattern.id);
188180
}
189181
}}
190182
>
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>
197185
</Rotate>
198186
</div>
199187
))}

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@ import {
1313
} from '@fluentui/react-components';
1414
import { Rotate, type Axis3D } from '@fluentui/react-motion-components-preview';
1515

16-
// import description from './ExperimentsRotate.stories.md';
17-
1816
const useClasses = makeStyles({
1917
container: {
2018
display: 'grid',

0 commit comments

Comments
 (0)