Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

inputData → inputAttrs

Steven Teye7180b3049a6
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/page-client.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/page-client.tsx
index 4675b334e9..539ea60d3c 100644
--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/page-client.tsx
+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/page-client.tsx
@@ -17,7 +17,7 @@ export default function ProjectSettingsClient() {
<Form
title="Project Name"
description={`This is the name of your project on ${process.env.NEXT_PUBLIC_APP_NAME}.`}
- inputData={{
+ inputAttrs={{
name: "name",
defaultValue: name,
placeholder: "My Project",
@@ -53,7 +53,7 @@ export default function ProjectSettingsClient() {
<Form
title="Project Slug"
description={`This is your project's unique slug on ${process.env.NEXT_PUBLIC_APP_NAME}.`}
- inputData={{
+ inputAttrs={{
name: "slug",
defaultValue: slug,
placeholder: "my-project",
diff --git a/apps/web/app/app.dub.co/(dashboard)/settings/page-client.tsx b/apps/web/app/app.dub.co/(dashboard)/settings/page-client.tsx
index 8f448426fa..977bf991f8 100644
--- a/apps/web/app/app.dub.co/(dashboard)/settings/page-client.tsx
+++ b/apps/web/app/app.dub.co/(dashboard)/settings/page-client.tsx
@@ -14,7 +14,7 @@ export default function SettingsPageClient() {
<Form
title="Your Name"
description={`This will be your display name on ${process.env.NEXT_PUBLIC_APP_NAME}.`}
- inputData={{
+ inputAttrs={{
name: "name",
defaultValue:
status === "loading" ? undefined : session?.user?.name || "",
@@ -43,7 +43,7 @@ export default function SettingsPageClient() {
<Form
title="Your Email"
description={`This will be the email you use to log in to ${process.env.NEXT_PUBLIC_APP_NAME} and receive notifications.`}
- inputData={{
+ inputAttrs={{
name: "email",
defaultValue: session?.user?.email || undefined,
placeholder: "[email protected]",
diff --git a/apps/web/app/app.dub.co/(dashboard)/settings/tokens/page-client.tsx b/apps/web/app/app.dub.co/(dashboard)/settings/tokens/page-client.tsx
index ae8c787401..344f9d5e7c 100644
--- a/apps/web/app/app.dub.co/(dashboard)/settings/tokens/page-client.tsx
+++ b/apps/web/app/app.dub.co/(dashboard)/settings/tokens/page-client.tsx
@@ -27,7 +27,7 @@ export default function TokensPageClient() {
<Form
title="Create New API Key"
description="Enter a unique name for your API key to differentiate it from other keys."
- inputData={{
+ inputAttrs={{
name: "name",
defaultValue: "",
placeholder: "Jetpack API Key",
diff --git a/apps/web/ui/modals/transfer-link-modal.tsx b/apps/web/ui/modals/transfer-link-modal.tsx
index e150c01248..0117dafd96 100644
--- a/apps/web/ui/modals/transfer-link-modal.tsx
+++ b/apps/web/ui/modals/transfer-link-modal.tsx
@@ -123,8 +123,7 @@ function TransferLinkModal({
}
selectedItem={selectedProject}
setSelectedItem={setSelectedProject}
- inputData={{
- autoFocus: isDesktop,
+ inputAttrs={{
placeholder: "Select a project",
}}
/>
diff --git a/packages/ui/src/form.tsx b/packages/ui/src/form.tsx
index 95ecb90060..cf14ecce94 100644
--- a/packages/ui/src/form.tsx
+++ b/packages/ui/src/form.tsx
@@ -5,7 +5,7 @@ import { Button } from "./button";
export function Form({
title,
description,
- inputData,
+ inputAttrs,
helpText,
buttonText = "Save Changes",
disabledTooltip,
@@ -13,17 +13,17 @@ export function Form({
}: {
title: string;
description: string;
- inputData: InputHTMLAttributes<HTMLInputElement>;
+ inputAttrs: InputHTMLAttributes<HTMLInputElement>;
helpText?: string;
buttonText?: string;
disabledTooltip?: string | ReactNode;
handleSubmit: (data: any) => Promise<any>;
}) {
- const [value, setValue] = useState(inputData.defaultValue);
+ const [value, setValue] = useState(inputAttrs.defaultValue);
const [saving, setSaving] = useState(false);
const saveDisabled = useMemo(() => {
- return saving || !value || value === inputData.defaultValue;
- }, [saving, value, inputData.defaultValue]);
+ return saving || !value || value === inputAttrs.defaultValue;
+ }, [saving, value, inputAttrs.defaultValue]);
return (
<form
@@ -31,7 +31,7 @@ export function Form({
e.preventDefault();
setSaving(true);
await handleSubmit({
- [inputData.name as string]: value,
+ [inputAttrs.name as string]: value,
});
setSaving(false);
}}
@@ -42,9 +42,9 @@ export function Form({
<h2 className="text-xl font-medium">{title}</h2>
<p className="text-sm text-gray-500">{description}</p>
</div>
- {typeof inputData.defaultValue === "string" ? (
+ {typeof inputAttrs.defaultValue === "string" ? (
<input
- {...inputData}
+ {...inputAttrs}
type="text"
required
disabled={disabledTooltip ? true : false}
diff --git a/packages/ui/src/input-select.tsx b/packages/ui/src/input-select.tsx
index 174ee77157..4fd00b1e3b 100644
--- a/packages/ui/src/input-select.tsx
+++ b/packages/ui/src/input-select.tsx
@@ -22,13 +22,13 @@ export function InputSelect({
selectedItem,
setSelectedItem,
icon,
- inputData,
+ inputAttrs,
}: {
items: InputSelectItemProps[];
selectedItem: InputSelectItemProps | null;
setSelectedItem: Dispatch<SetStateAction<InputSelectItemProps | null>>;
icon?: ReactNode;
- inputData?: InputHTMLAttributes<HTMLInputElement>;
+ inputAttrs?: InputHTMLAttributes<HTMLInputElement>;
}) {
const commandRef = useRef<HTMLDivElement | null>(null);
const [openCommandList, setOpenCommandList] = useState(false);
@@ -53,9 +53,9 @@ export function InputSelect({
const isEmpty = useCommandState((state: any) => state.filtered.count === 0);
return (
<Command.Input
- placeholder={inputData?.placeholder || "Search..."}
+ placeholder={inputAttrs?.placeholder || "Search..."}
// hack to focus on the input when the dropdown opens
- autoFocus={inputData?.autoFocus || openCommandList}
+ autoFocus={openCommandList}
// when focus on the input. only show the dropdown if there are tags and the tagValue is not empty
onFocus={() => setOpenCommandList(true)}
value={inputValue}