import { HStack } from './Stacks'; import { DropdownMenuRadio } from './Dropdown'; import { Button } from './Button'; import { Input } from './Input'; import { FormEvent, useState } from 'react'; import { IconButton } from './IconButton'; interface Props { sendRequest: () => Promise; method: { label: string; value: string }; url: string; onMethodChange: (method: { label: string; value: string }) => void; onUrlChange: (url: string) => void; } export function UrlBar({ sendRequest, onMethodChange, method, onUrlChange, url }: Props) { const [loading, setLoading] = useState(false); const handleSendRequest = async (e: FormEvent) => { e.preventDefault(); if (loading) return; setLoading(true); try { await sendRequest(); } finally { setLoading(false); } }; return (
onUrlChange(e.currentTarget.value)} value={url} placeholder="Enter a URL..." leftSlot={ } rightSlot={ } /> ); }