Skip to content

Open source CapCut alternative.

TypeScript

fix(site): su offer fields keep their inputs level and the claim label whole

David Le7ba2c82d64cd
diff --git a/site/src/app/su/CreditOfferFields.tsx b/site/src/app/su/CreditOfferFields.tsx
index 9a26742d..333522ff 100644
--- a/site/src/app/su/CreditOfferFields.tsx
+++ b/site/src/app/su/CreditOfferFields.tsx
@@ -69,7 +69,7 @@ export function CreditOfferFields({
/>
</div>
{value ? (
- <div className="grid grid-cols-2 gap-3 sm:grid-cols-4">
+ <div className="grid grid-cols-2 gap-3 sm:grid-cols-[auto_repeat(3,minmax(0,1fr))]">
<Field label="Landed by" htmlFor={`${idPrefix}-claim`}>
<Select
disabled={disabled}
@@ -77,8 +77,8 @@ export function CreditOfferFields({
items={OFFER_CLAIM_NAMES}
onValueChange={(v) => onChange({ ...value, claim: v as OfferClaim })}
>
- <SelectTrigger id={`${idPrefix}-claim`} className="w-full min-w-0">
- <SelectValue className="truncate" />
+ <SelectTrigger id={`${idPrefix}-claim`} className="w-full">
+ <SelectValue />
</SelectTrigger>
<SelectContent>
{OFFER_CLAIMS.map((claim) => (
diff --git a/site/src/app/su/Field.tsx b/site/src/app/su/Field.tsx
index 5d1e5136..e06929f3 100644
--- a/site/src/app/su/Field.tsx
+++ b/site/src/app/su/Field.tsx
@@ -1,9 +1,10 @@
import { Label } from "@/components/ui/label";
-// A labelled control in an su form.
+// A labelled control in an su form. The control sits at the bottom, so in a
+// row of fields the inputs stay level when one label wraps.
export function Field({ label, htmlFor, children }: { label: string; htmlFor: string; children: React.ReactNode }) {
return (
- <div className="space-y-1.5">
+ <div className="flex flex-col gap-1.5 *:last:mt-auto">
<Label htmlFor={htmlFor} className="text-xs text-muted-foreground">
{label}
</Label>