import React, { useRef, forwardRef } from 'react'; import { IconCaretDown } from '@tabler/icons'; import Dropdown from 'components/Dropdown'; import StyledWrapper from './StyledWrapper'; const HttpMethodSelector = ({method, onMethodSelect}) => { const dropdownTippyRef = useRef(); const onDropdownCreate = (ref) => dropdownTippyRef.current = ref; const Icon = forwardRef((props, ref) => { return (
{method}
); }); const handleMethodSelect = (verb) => onMethodSelect(verb); const Verb = ({verb}) => { return (
{ dropdownTippyRef.current.hide(); handleMethodSelect(verb); }}> {verb}
); }; return(
} placement='bottom-start'>
); }; export default HttpMethodSelector;