mirror of
https://github.com/aykhans/slash-e.git
synced 2025-09-06 09:14:18 +00:00
33 lines
943 B
TypeScript
33 lines
943 B
TypeScript
import { useState } from "react";
|
|
import CreateShortcutDialog from "./CreateShortcutDialog";
|
|
import ShortcutView from "./ShortcutView";
|
|
|
|
interface Props {
|
|
shortcutList: Shortcut[];
|
|
}
|
|
|
|
const ShortcutListView: React.FC<Props> = (props: Props) => {
|
|
const { shortcutList } = props;
|
|
const [editingShortcutId, setEditingShortcutId] = useState<ShortcutId | undefined>();
|
|
|
|
return (
|
|
<>
|
|
<div className="w-full flex flex-col justify-start items-start">
|
|
{shortcutList.map((shortcut) => {
|
|
return <ShortcutView key={shortcut.id} shortcut={shortcut} handleEdit={() => setEditingShortcutId(shortcut.id)} />;
|
|
})}
|
|
</div>
|
|
|
|
{editingShortcutId && (
|
|
<CreateShortcutDialog
|
|
shortcutId={editingShortcutId}
|
|
onClose={() => setEditingShortcutId(undefined)}
|
|
onConfirm={() => setEditingShortcutId(undefined)}
|
|
/>
|
|
)}
|
|
</>
|
|
);
|
|
};
|
|
|
|
export default ShortcutListView;
|