mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-01-16 14:06:49 +01:00
28 lines
832 B
TypeScript
28 lines
832 B
TypeScript
import classNames from 'classnames';
|
|
import React, { Fragment } from 'react';
|
|
import type { HotkeyAction } from '../../hooks/useHotKey';
|
|
import { HotKey } from './HotKey';
|
|
import { HotKeyLabel } from './HotKeyLabel';
|
|
|
|
interface Props {
|
|
hotkeys: HotkeyAction[];
|
|
bottomSlot?: React.ReactNode;
|
|
className?: string;
|
|
}
|
|
|
|
export const HotKeyList = ({ hotkeys, bottomSlot, className }: Props) => {
|
|
return (
|
|
<div className={classNames(className, 'h-full flex items-center justify-center')}>
|
|
<div className="px-4 grid gap-2 grid-cols-[auto_auto]">
|
|
{hotkeys.map((hotkey) => (
|
|
<Fragment key={hotkey}>
|
|
<HotKeyLabel className="truncate" action={hotkey} />
|
|
<HotKey className="ml-4" action={hotkey} />
|
|
</Fragment>
|
|
))}
|
|
{bottomSlot}
|
|
</div>
|
|
</div>
|
|
);
|
|
};
|