Skip to content

Commit

Permalink
docs(keyboard-key): lint and format
Browse files Browse the repository at this point in the history
  • Loading branch information
krisantrobus committed Nov 18, 2024
1 parent 0d296ae commit c9a5070
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 42 deletions.
3 changes: 2 additions & 1 deletion packages/paste-core/components/keyboard-key/src/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ const useKeyEvents = (): { activeKeys: string[] } => {
};

const stringArrayMatches = (arr1: string[], arr2: string[]): boolean =>
JSON.stringify(arr1.sort((a, b) => a.localeCompare(b)).map(s => s.toLowerCase())) === JSON.stringify(arr2.sort((a, b) => a.localeCompare(b)));
JSON.stringify(arr1.sort((a, b) => a.localeCompare(b)).map((s) => s.toLowerCase())) ===
JSON.stringify(arr2.sort((a, b) => a.localeCompare(b)));

export const useKeyCombination = ({
keys,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -270,43 +270,3 @@ Customization.paramters = {
disabled: true,
},
};

export const MenuExample = () => {
const menu = useMenuState();
return (
<>
<MenuButton {...menu} variant="secondary">
Edit <ChevronDownIcon decorative />
</MenuButton>
<Menu {...menu} aria-label="Actions">
<MenuItem {...menu}>
<Box display="flex" justifyContent="space-between">
Cut
<KeyboardKeyGroup>
<KeyboardKey>Cmd</KeyboardKey>
<KeyboardKey>X</KeyboardKey>
</KeyboardKeyGroup>
</Box>
</MenuItem>
<MenuItem {...menu}>
<Box display="flex" justifyContent="space-between">
Paste
<KeyboardKeyGroup>
<KeyboardKey>Cmd</KeyboardKey>
<KeyboardKey>V</KeyboardKey>
</KeyboardKeyGroup>
</Box>
</MenuItem>
<MenuItem disabled aria-disabled {...menu}>
<Box display="flex" justifyContent="space-between">
Save
<KeyboardKeyGroup disabled>
<KeyboardKey>Cmd</KeyboardKey>
<KeyboardKey>S</KeyboardKey>
</KeyboardKeyGroup>
</Box>
</MenuItem>{" "}
</Menu>
</>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ export const tooltipExample = `<Stack orientation="horizontal" spacing="space60"
<SearchIcon title="search" />
</Button>
</Tooltip>
</Stack>`.trim()
</Stack>`.trim();

export const useKeyCombinationExample = `const HookExample = () => {
const [combinationTriggeredText, setCombinationTriggeredText] = React.useState("");
Expand Down

0 comments on commit c9a5070

Please sign in to comment.