({ className }: UrlFormProps)
| 6 | }; |
| 7 | |
| 8 | export function UrlForm({ className }: UrlFormProps) { |
| 9 | const transition = useTransition(); |
| 10 | const [inputValue, setInputValue] = useState(""); |
| 11 | |
| 12 | const isNotIdle = transition.state !== "idle"; |
| 13 | const isButtonDisabled = !inputValue.length || isNotIdle; |
| 14 | |
| 15 | return ( |
| 16 | <Form |
| 17 | method="post" |
| 18 | action="/actions/createFromUrl" |
| 19 | className={`${className}`} |
| 20 | > |
| 21 | <div className="flex"> |
| 22 | <input |
| 23 | type="text" |
| 24 | name="jsonUrl" |
| 25 | id="jsonUrl" |
| 26 | className="block flex-grow text-base text-slate-200 placeholder:text-slate-300 bg-slate-900/40 border border-slate-600 rounded-l-sm py-2 px-3 transition duration-300 focus:ring-indigo-500 focus:border-indigo-500" |
| 27 | placeholder="Enter a JSON URL or paste in JSON here..." |
| 28 | value={inputValue} |
| 29 | onChange={(event) => setInputValue(event.target.value)} |
| 30 | /> |
| 31 | <button |
| 32 | type="submit" |
| 33 | value="Go" |
| 34 | className={`inline-flex items-center justify-center px-4 py-2 border border-transparent font-medium rounded-r-sm text-white bg-lime-500 transition hover:bg-lime-600 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-lime-500 ${ |
| 35 | isButtonDisabled && "disabled:opacity-50 disabled:hover:bg-lime-500" |
| 36 | }`} |
| 37 | disabled={isButtonDisabled} |
| 38 | > |
| 39 | {isNotIdle ? "..." : "Go"} |
| 40 | </button> |
| 41 | </div> |
| 42 | </Form> |
| 43 | ); |
| 44 | } |
nothing calls this directly
no outgoing calls
no test coverage detected