Skip to content

Commit

Permalink
refactor(MessageBar): delete and deprecate unused CSS animation code
Browse files Browse the repository at this point in the history
  • Loading branch information
robertpenner committed Dec 17, 2024
1 parent 56708e0 commit ee1613c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 42 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@ export type MessageBarGroupProps = ComponentProps<MessageBarGroupSlots> & {
*/
export type MessageBarGroupState = ComponentState<MessageBarGroupSlots> &
Pick<MessageBarGroupProps, 'animate'> & {
// TODO: deprecate these 2 obsolete props?
/** @deprecated property is unused; these CSS animations were replaced by motion components */
enterStyles: string;
/** @deprecated property is unused; these CSS animations were replaced by motion components */
exitStyles: string;
children: React.ReactElement[];
};
Original file line number Diff line number Diff line change
@@ -1,57 +1,17 @@
import { makeStyles, mergeClasses } from '@griffel/react';
import { tokens } from '@fluentui/react-theme';
import { mergeClasses } from '@griffel/react';
import type { SlotClassNames } from '@fluentui/react-utilities';
import type { MessageBarGroupSlots, MessageBarGroupState } from './MessageBarGroup.types';

export const messageBarGroupClassNames: SlotClassNames<MessageBarGroupSlots> = {
root: 'fui-MessageBarGroup',
};

// TODO: delete this obsolete code to save bytes?
/**
* Styles for the root slot
*/
const useStyles = makeStyles({
base: {
animationFillMode: 'forwards',
animationDuration: tokens.durationNormal,
},

enter: {
animationName: {
from: {
opacity: 0,
transform: 'translateY(-100%)',
},
to: {
opacity: 1,
transform: 'translateY(0)',
},
},
},

exit: {
animationName: {
from: {
opacity: 1,
},
to: {
opacity: 0,
},
},
},
});

/**
* Apply styling to the MessageBarGroup slots based on the state
*/
export const useMessageBarGroupStyles_unstable = (state: MessageBarGroupState): MessageBarGroupState => {
'use no memo';

const styles = useStyles();
state.root.className = mergeClasses(messageBarGroupClassNames.root, state.root.className);
// TODO: delete these 2 lines to save bytes?
state.enterStyles = mergeClasses(styles.base, styles.enter);
state.exitStyles = mergeClasses(styles.base, styles.exit);
return state;
};

0 comments on commit ee1613c

Please sign in to comment.