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.

prevent long label URLs from overflowing form controls

Pedro Ladeira9bd7672e60d5
diff --git a/apps/web/app/(ee)/partners.dub.co/(onboarding)/onboarding/onboarding-form.tsx b/apps/web/app/(ee)/partners.dub.co/(onboarding)/onboarding/onboarding-form.tsx
index d4189bbe5f..26228afd88 100644
--- a/apps/web/app/(ee)/partners.dub.co/(onboarding)/onboarding/onboarding-form.tsx
+++ b/apps/web/app/(ee)/partners.dub.co/(onboarding)/onboarding/onboarding-form.tsx
@@ -3,9 +3,13 @@
import { parseActionError } from "@/lib/actions/parse-action-errors";
import { onboardPartnerAction } from "@/lib/actions/partners/onboard-partner";
import { getValidInternalRedirectPath } from "@/lib/middleware/utils/is-valid-internal-redirect";
-import { onboardPartnerSchema } from "@/lib/zod/schemas/partners";
+import {
+ MAX_PARTNER_DESCRIPTION_LENGTH,
+ onboardPartnerSchema,
+} from "@/lib/zod/schemas/partners";
import { CountryCombobox } from "@/ui/partners/country-combobox";
import { useCountryChangeWarningModal } from "@/ui/partners/use-country-change-warning-modal";
+import { MaxCharactersCounter } from "@/ui/shared/max-characters-counter";
import { Partner } from "@dub/prisma/client";
import {
Button,
@@ -217,18 +221,26 @@ export function OnboardingForm({
Description
<span className="font-normal text-neutral-500"> (optional)</span>
</span>
- <ReactTextareaAutosize
- className={cn(
- "mt-1.5 block w-full rounded-md focus:outline-none sm:text-sm",
- errors.description
- ? "border-red-300 pr-10 text-red-900 placeholder-red-300 focus:border-red-500 focus:ring-red-500"
- : "border-neutral-300 text-neutral-900 placeholder-neutral-400 focus:border-neutral-500 focus:ring-neutral-500",
- )}
- placeholder="Tell us about the kind of content you create – e.g. tech, travel, fashion, etc."
- minRows={3}
- onKeyDown={handleKeyDown}
- {...register("description")}
- />
+ <div>
+ <ReactTextareaAutosize
+ className={cn(
+ "mt-1.5 block w-full rounded-md focus:outline-none sm:text-sm",
+ errors.description
+ ? "border-red-300 pr-10 text-red-900 placeholder-red-300 focus:border-red-500 focus:ring-red-500"
+ : "border-neutral-300 text-neutral-900 placeholder-neutral-400 focus:border-neutral-500 focus:ring-neutral-500",
+ )}
+ placeholder="Tell us about the kind of content you create – e.g. tech, travel, fashion, etc."
+ maxLength={MAX_PARTNER_DESCRIPTION_LENGTH}
+ minRows={3}
+ onKeyDown={handleKeyDown}
+ {...register("description")}
+ />
+ <MaxCharactersCounter
+ name="description"
+ maxLength={MAX_PARTNER_DESCRIPTION_LENGTH}
+ control={control}
+ />
+ </div>
</label>
<LayoutGroup>
diff --git a/apps/web/ui/partners/groups/design/application-form/fields/form-control.tsx b/apps/web/ui/partners/groups/design/application-form/fields/form-control.tsx
index cf805f5cce..ffd33ccbcb 100644
--- a/apps/web/ui/partners/groups/design/application-form/fields/form-control.tsx
+++ b/apps/web/ui/partners/groups/design/application-form/fields/form-control.tsx
@@ -28,8 +28,8 @@ export const FormControl = ({
}: FormControlProps) => {
return (
<label {...rest}>
- <div className="flex items-center gap-1.5" dir={labelDir}>
- <span className="text-content-emphasis text-sm font-medium">
+ <div className="flex min-w-0 items-center gap-1.5" dir={labelDir}>
+ <span className="text-content-emphasis min-w-0 break-words text-sm font-medium">
{label}
</span>
{required && <FormControlRequiredBadge />}