Skip to content

Commit

Permalink
fixup! fixup! docs(react-keytips): add more detailed Overflow example
Browse files Browse the repository at this point in the history
  • Loading branch information
mainframev committed Dec 27, 2024
1 parent 442bba4 commit f37a6b5
Show file tree
Hide file tree
Showing 8 changed files with 92 additions and 117 deletions.
5 changes: 3 additions & 2 deletions packages/react-keytips/stories/Overflow/Help/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@ import {
import {
SettingsRegular,
PersonCallRegular,
PeopleCallRegular,
FlagRegular,
HeadsetRegular,
} from '@fluentui/react-icons';
import { keytipsMap } from './keytipsMap';
import { helpKeytips as keytipsMap } from '../keytipsMap';
import { OverflowItemCustom } from '../OverflowItemCustom';
import { useStyles } from '../useStyles';
import { OverflowMenu } from '../OverflowMenu';
Expand Down Expand Up @@ -42,7 +43,7 @@ const menuItems = [
disabled: false,
name: 'Feedback',
keytipProps: keytipsMap.feedback,
// icon: <NotepadPersonIcon />,
icon: <PeopleCallRegular />,
},
{
id: '5',
Expand Down
43 changes: 0 additions & 43 deletions packages/react-keytips/stories/Overflow/Help/keytipsMap.ts

This file was deleted.

14 changes: 7 additions & 7 deletions packages/react-keytips/stories/Overflow/Home/EmailMenuButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ import {
Menu,
useMergedRefs,
mergeCallbacks,
MenuButtonProps,
MenuList,
MenuItem,
MenuPopover,
MenuTrigger,
SplitButton,
SplitButtonProps,
type SplitButtonProps,
type MenuButtonProps,
} from '@fluentui/react-components';
import { MailRegular } from '@fluentui/react-icons';
import { keytipsMap } from './keytipsMap';
Expand Down Expand Up @@ -42,20 +42,20 @@ export const EmailMenu = React.forwardRef<
SplitButtonProps & { isOverflowing?: boolean }
>((props, ref) => {
const keytipRef = useKeytipRef(keytipsMap.newMail);
const mergedRefs = useMergedRefs(ref, keytipRef);

return (
<Menu positioning="below-end">
<MenuTrigger disableButtonEnhancement>
{(triggerProps: MenuButtonProps) => (
{(
triggerProps: MenuButtonProps & { ref: React.Ref<HTMLButtonElement> }
) => (
<SplitButton
ref={mergedRefs}
ref={ref}
appearance="primary"
icon={<MailRegular />}
menuButton={{
...triggerProps,
// @ts-expect-error TODO
ref: mergeCallbacks(triggerProps.ref, keytipRef),
ref: useMergedRefs(triggerProps.ref, keytipRef),
}}
{...props}
>
Expand Down
2 changes: 1 addition & 1 deletion packages/react-keytips/stories/Overflow/Home/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {
MailUnreadRegular,
} from '@fluentui/react-icons';
import { EmailMenu } from './EmailMenuButton';
import { keytipsMap } from './keytipsMap';
import { homeKeytips as keytipsMap } from '../keytipsMap';
import { OverflowItemCustom } from '../OverflowItemCustom';
import { useStyles } from '../useStyles';
import { OverflowMenu } from '../OverflowMenu';
Expand Down
8 changes: 0 additions & 8 deletions packages/react-keytips/stories/Overflow/Overflow.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,3 @@ export const OverflowStory = () => {
</div>
);
};

OverflowStory.parameters = {
docs: {
description: {
story: '',
},
},
};
2 changes: 1 addition & 1 deletion packages/react-keytips/stories/Overflow/View/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
FolderRegular,
TextDensityRegular,
} from '@fluentui/react-icons';
import { keytipsMap, onExecute } from './keytipsMap';
import { viewKeytips as keytipsMap, onExecute } from '../keytipsMap';
import { OverflowItemCustom } from '../OverflowItemCustom';
import { useStyles } from '../useStyles';
import { OverflowMenu } from '../OverflowMenu';
Expand Down
54 changes: 0 additions & 54 deletions packages/react-keytips/stories/Overflow/View/keytipsMap.ts

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,41 @@ export const onExecute: ExecuteKeytipEventHandler = (_, { targetElement }) => {
}
};

export const keytipsMap = {
export const helpKeytips = {
help: {
content: 'H',
keySequences: ['e', 'h'],
onExecute,
},
tips: {
content: 'P',
keySequences: ['e', 'p'],
onExecute,
},
support: {
content: 'U',
keySequences: ['e', 'u'],
onExecute,
},
feedback: {
content: 'F',
keySequences: ['e', 'f'],
onExecute,
},
rollout: {
content: 'R',
keySequences: ['e', 'r'],
onExecute,
},
overflowButton: {
dynamic: true,
content: '00',
keySequences: ['e', '00'],
onExecute,
},
};

export const homeKeytips = {
newMail: {
content: 'N',
keySequences: ['h', 'n'],
Expand Down Expand Up @@ -110,3 +144,48 @@ export const keytipsMap = {
onExecute,
},
};

export const viewKeytips = {
viewSettings: {
content: 'V',
keySequences: ['v', 'v'],
onExecute,
},
messages: {
content: 'M',
keySequences: ['v', 'm'],
onExecute,
},
zoom: {
content: 'Z',
keySequences: ['v', 'z'],
onExecute,
},
sync: {
content: 'S',
keySequences: ['v', 's'],
onExecute,
},
layout: {
content: 'A',
keySequences: ['v', 'a'],
dynamic: true,
onExecute,
},
folderPane: {
content: 'F',
keySequences: ['v', 'f'],
onExecute,
},
density: {
content: 'D',
keySequences: ['v', 'd'],
onExecute,
},
overflowButton: {
dynamic: true,
content: '00',
keySequences: ['v', '00'],
onExecute,
},
};

0 comments on commit f37a6b5

Please sign in to comment.