Skip to content

Commit 7aa4fb1

Browse files
ArrayKnightclaude
andcommitted
refactor(react-windmod-preview): inline InfoButton's size-to-typography choice as a ternary
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Aj9uA3rCVgosnh2zNn8qkc
1 parent 68bb856 commit 7aa4fb1

1 file changed

Lines changed: 4 additions & 11 deletions

File tree

packages/react-components/react-windmod-preview/library/src/components/InfoButton/useInfoButtonStyles.ts

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { clsx } from 'clsx';
22

33
import { componentMarkers } from '../../utils/groupMarker';
44
import { slotClasses } from '../../utils/slotClasses';
5-
import type { InfoButtonSize, InfoButtonState } from './InfoButton.types';
5+
import type { InfoButtonState } from './InfoButton.types';
66

77
import styles from './InfoButton.module.css';
88

@@ -15,15 +15,6 @@ type InfoButtonRootDataAttributes = {
1515
'data-size'?: InfoButtonState['size'];
1616
};
1717

18-
/** Keyed off the button's own size, never off the surface's: a consumer may set the popover's
19-
* size directly, and Griffel still resolves the typography from the button. */
20-
const infoTypographyClass = (size: InfoButtonSize): string => {
21-
if (size === 'large') {
22-
return styles.infoLarge;
23-
}
24-
return styles.infoSmallMedium;
25-
};
26-
2718
/**
2819
* Applies the visual contract, returning new state. The headless hook already stamps data-open,
2920
* which is the whole open/selected channel; data-size is style-only.
@@ -40,6 +31,8 @@ export const useInfoButtonStyles = (state: InfoButtonState): InfoButtonState =>
4031
return {
4132
...state,
4233
root,
43-
info: slotClasses(state.info, styles.info, infoTypographyClass(size)),
34+
/* Keyed off the button's own size, never off the surface's: a consumer may set the popover's
35+
* size directly, and Griffel still resolves the typography from the button. */
36+
info: slotClasses(state.info, styles.info, size === 'large' ? styles.infoLarge : styles.infoSmallMedium),
4437
};
4538
};

0 commit comments

Comments
 (0)