Skip to content

Commit 94a1d8f

Browse files
committed
more feedback
1 parent bd17318 commit 94a1d8f

File tree

2 files changed

+21
-3
lines changed

2 files changed

+21
-3
lines changed

packages/react-components/react-tooltip/stories/src/Tooltip/TooltipDefault.stories.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { SlideTextRegular } from '@fluentui/react-icons';
55
import type { TooltipProps } from '@fluentui/react-components';
66

77
export const Default = (props: Partial<TooltipProps>) => (
8-
<Tooltip visible={true} content="Example tooltip" relationship="label" {...props}>
8+
<Tooltip content="Example tooltip" relationship="label" {...props}>
99
<Button icon={<SlideTextRegular />} size="large" />
1010
</Tooltip>
1111
);

packages/react-components/semantic-style-hooks-preview/library/src/component-styles/Tooltip/useSemanticTooltipStyles.styles.ts

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,18 @@ import * as semanticTokens from '@fluentui/semantic-tokens';
33
import { getSlotClassNameProp_unstable } from '@fluentui/react-utilities';
44
import type { TooltipState } from '@fluentui/react-tooltip';
55
import { tokens } from '@fluentui/react-theme';
6+
import { createArrowStyles } from '@fluentui/react-positioning';
67

78
const useStyles = makeStyles({
89
root: {
10+
display: 'none',
11+
boxSizing: 'border-box',
12+
maxWidth: '240px',
13+
cursor: 'default',
14+
overflowWrap: 'break-word',
15+
916
borderRadius: semanticTokens.ctrlTooltipCorner,
17+
border: `1px solid ${semanticTokens.strokeLayer}`,
1018

1119
paddingTop: semanticTokens._ctrlTooltipPaddingTop,
1220
paddingBottom: semanticTokens._ctrlTooltipPaddingBottom,
@@ -22,12 +30,19 @@ const useStyles = makeStyles({
2230

2331
filter: semanticTokens._ctrlTooltipShadow,
2432
},
33+
visible: {
34+
display: 'block',
35+
},
2536

2637
// Semantic-tokens does not include inverted tokens, use existing tokens for now.
2738
inverted: {
2839
backgroundColor: tokens.colorNeutralBackgroundStatic,
2940
color: tokens.colorNeutralForegroundStaticInverted,
3041
},
42+
43+
// 6 is defined by a constant internal to tooltip
44+
// I don't know if any tokens for it, or if it should be a token.
45+
arrow: createArrowStyles({ arrowHeight: 6, borderColor: semanticTokens.strokeLayer }),
3146
});
3247

3348
export const useSemanticTooltipStyles = (_state: unknown): TooltipState => {
@@ -36,14 +51,17 @@ export const useSemanticTooltipStyles = (_state: unknown): TooltipState => {
3651
const state = _state as TooltipState;
3752

3853
const styles = useStyles();
39-
const { appearance } = state;
54+
const { appearance, visible } = state;
4055

4156
state.content.className = mergeClasses(
4257
state.content.className,
43-
appearance === 'inverted' && styles.inverted,
4458
styles.root,
59+
appearance === 'inverted' && styles.inverted,
60+
visible && styles.visible,
4561
getSlotClassNameProp_unstable(state.content),
4662
);
4763

64+
state.arrowClassName = styles.arrow;
65+
4866
return state;
4967
};

0 commit comments

Comments
 (0)