mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-04 14:38:45 +00:00
I really hope I didnt fuck anything up now
This commit is contained in:
1 parent
ad20755608
commit
ec37fcde46
67 files changed
No files matched your search
@@ -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,
|
||||
];
|
||||
};
|
||||
Whitespace-only changes.
Reference in new issue
Block a user