Use placeholders constants with SimplifiedTargetType

This commit is contained in:
2024-05-10 05:58:35 -05:00
parent e1ad2a8692
commit 34a3c8efa6
2 changed files with 6 additions and 5 deletions

View File

@@ -12,6 +12,7 @@ import {
import { Listbox, Transition } from "@headlessui/react";
import clsx from "clsx";
import type { Maybe } from "true-myth";
import { placeholders } from "@/constants";
/**
* Props for the LookupInput component.
@@ -136,7 +137,7 @@ const LookupInput: FunctionComponent<LookupInputProps> = ({
" focus:outline-none sm:text-sm md:py-3 md:text-base lg:text-lg"
)}
disabled={isLoading}
placeholder="A domain, an IP address, a TLD, an RDAP URL..."
placeholder={placeholders[selected]}
type="search"
{...register("target", {
required: true,

View File

@@ -1,5 +1,5 @@
// see https://www.iana.org/assignments/rdap-json-values
import type { RdapStatusType, RootRegistryType, TargetType } from "@/types";
import type { RdapStatusType, RootRegistryType, SimplifiedTargetType, TargetType } from "@/types";
export const rdapStatusInfo: Record<RdapStatusType, string> = {
validated:
@@ -79,9 +79,9 @@ export const registryURLs: Record<RootRegistryType, string> = {
entity: "https://data.iana.org/rdap/object-tags.json",
};
export const placeholders: Record<TargetType, string> = {
ip4: "192.168.0.1/16",
ip6: "TODO: Complete this placeholder",
export const placeholders: Record<SimplifiedTargetType | "auto", string> = {
auto: "A domain, an IP address, a TLD, an RDAP URL...",
ip: "192.168.0.1/16 or 2001:db8::/32",
autnum: "65535",
entity: "ABC123-EXAMPLE",
url: "https://rdap.org/domain/example.com",