I really hope I didnt fuck anything up now

This commit is contained in:
chip committed 2020-08-23 20:08:08 +02:00
1 parent ad20755608
commit ec37fcde46
67 files changed

No files matched your search

+30
View File
@@ -0,0 +1,30 @@
import React, { useState } from "react";
import { ContextMenu } from "../components/ContextMenu";
export const MapStringOptions = (current, onClick) => (string) => {
return {
selected: current === string,
label: string,
key: string,
onClick: () => onClick(string)
};
};
export const useContextMenu = (_options = []) => {
const [open, setOpen] = useState();
const [options, setOptions] = useState(_options);
const onClose = () => setOpen(false);
const onOpen = (opts) => {
setOptions(opts);
setOpen(true);
};
return [
onOpen,
onClose,
() => <ContextMenu open={open} onClose={onClose} options={options} />,
open,
];
};
View File
Whitespace-only changes.