Files
yaak/src-web/components/core/HotKeyList.tsx
2024-02-22 00:49:22 -08:00

27 lines
754 B
TypeScript

import React from 'react';
import type { HotkeyAction } from '../../hooks/useHotKey';
import { HotKey } from './HotKey';
import { HotKeyLabel } from './HotKeyLabel';
import { HStack, VStack } from './Stacks';
interface Props {
hotkeys: HotkeyAction[];
bottomSlot?: React.ReactNode;
}
export const HotKeyList = ({ hotkeys, bottomSlot }: Props) => {
return (
<div className="mx-auto h-full flex items-center text-gray-700 text-sm">
<VStack space={2}>
{hotkeys.map((hotkey) => (
<HStack key={hotkey} className="grid grid-cols-2">
<HotKeyLabel action={hotkey} />
<HotKey className="ml-auto" action={hotkey} />
</HStack>
))}
{bottomSlot}
</VStack>
</div>
);
};