Skip to content

Commit b224d02

Browse files
committed
Many style changes to the env var form
1 parent ac16ccc commit b224d02

1 file changed

Lines changed: 66 additions & 78 deletions

File tree

  • apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.environment-variables.new

apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.environment-variables.new/route.tsx

Lines changed: 66 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -214,14 +214,10 @@ export default function Page() {
214214
}
215215
}}
216216
>
217-
<DialogContent className="md:max-w-2xl lg:max-w-3xl">
218-
<DialogHeader>New environment variables</DialogHeader>
219-
<Form
220-
method="post"
221-
{...form.props}
222-
className="max-h-[70vh] overflow-y-auto scrollbar-thin scrollbar-track-transparent scrollbar-thumb-charcoal-600"
223-
>
224-
<Fieldset className="mt-2">
217+
<DialogContent className="p-0 pt-2.5 md:max-w-2xl lg:max-w-3xl">
218+
<DialogHeader className="px-4">New environment variables</DialogHeader>
219+
<Form method="post" {...form.props}>
220+
<Fieldset className="max-h-[70vh] overflow-y-auto p-4 scrollbar-thin scrollbar-track-transparent scrollbar-thumb-charcoal-600">
225221
<InputGroup fullWidth>
226222
<Label>Environments</Label>
227223
<div className="flex items-center gap-2">
@@ -242,7 +238,7 @@ export default function Page() {
242238
<TooltipTrigger>
243239
<TextLink
244240
to={v3BillingPath(organization)}
245-
className="flex w-fit cursor-pointer items-center gap-2 rounded border border-dashed border-charcoal-600 py-3 pl-3 pr-4 transition hover:border-charcoal-500 hover:bg-charcoal-850"
241+
className="flex w-fit cursor-pointer items-center gap-2 rounded border border-dashed border-charcoal-600 py-2.5 pl-3 pr-4 transition hover:border-charcoal-500 hover:bg-charcoal-850"
246242
>
247243
<LockClosedIcon className="size-4 text-charcoal-500" />
248244
<EnvironmentLabel environment={{ type: "STAGING" }} className="text-sm" />
@@ -265,14 +261,18 @@ export default function Page() {
265261
<InputGroup className="w-auto">
266262
<Switch
267263
name="isSecret"
268-
variant="large"
269-
label="Secret?"
264+
variant="medium"
270265
defaultChecked={false}
271266
value="true"
267+
className="-ml-2 inline-flex w-fit"
268+
label={<span className="text-text-bright">Secret value</span>}
272269
/>
270+
<Hint className="-mt-1">
271+
If enabled, you and your team will not be able to view the values after creation.
272+
</Hint>
273273
</InputGroup>
274274
<InputGroup fullWidth>
275-
<FieldLayout showDeleteButton={false}>
275+
<FieldLayout>
276276
<Label>Keys</Label>
277277
<div className="flex justify-between gap-1">
278278
<Label>Values</Label>
@@ -294,61 +294,47 @@ export default function Page() {
294294
</InputGroup>
295295

296296
<FormError>{form.error}</FormError>
297-
<FormButtons
298-
confirmButton={
299-
<div className="flex flex-row-reverse items-center gap-2">
300-
<Button
301-
type="submit"
302-
variant="primary/medium"
303-
disabled={isLoading}
304-
name="override"
305-
value="false"
306-
>
307-
{isLoading ? "Saving" : "Save"}
308-
</Button>
309-
<Button
310-
variant="secondary/medium"
311-
disabled={isLoading}
312-
name="override"
313-
value="true"
314-
>
315-
{isLoading ? "Overriding" : "Override"}
316-
</Button>
317-
</div>
318-
}
319-
cancelButton={
320-
<LinkButton
321-
to={v3EnvironmentVariablesPath(organization, project, environment)}
322-
variant="tertiary/medium"
323-
>
324-
Cancel
325-
</LinkButton>
326-
}
327-
/>
328297
</Fieldset>
298+
<FormButtons
299+
className="px-4 pb-4"
300+
confirmButton={
301+
<div className="flex flex-row-reverse items-center gap-2">
302+
<Button
303+
type="submit"
304+
variant="primary/medium"
305+
disabled={isLoading}
306+
name="override"
307+
value="false"
308+
>
309+
{isLoading ? "Saving" : "Save"}
310+
</Button>
311+
<Button
312+
variant="secondary/medium"
313+
disabled={isLoading}
314+
name="override"
315+
value="true"
316+
>
317+
{isLoading ? "Overriding" : "Override"}
318+
</Button>
319+
</div>
320+
}
321+
cancelButton={
322+
<LinkButton
323+
to={v3EnvironmentVariablesPath(organization, project, environment)}
324+
variant="tertiary/medium"
325+
>
326+
Cancel
327+
</LinkButton>
328+
}
329+
/>
329330
</Form>
330331
</DialogContent>
331332
</Dialog>
332333
);
333334
}
334335

335-
function FieldLayout({
336-
children,
337-
showDeleteButton,
338-
}: {
339-
children: React.ReactNode;
340-
showDeleteButton: boolean;
341-
}) {
342-
return (
343-
<div
344-
className={cn(
345-
"grid w-full gap-1.5",
346-
showDeleteButton ? "grid-cols-[1fr_1fr_2rem]" : "grid-cols-[1fr_1fr]"
347-
)}
348-
>
349-
{children}
350-
</div>
351-
);
336+
function FieldLayout({ children }: { children: React.ReactNode }) {
337+
return <div className="grid w-full grid-cols-[1fr_1fr] gap-1.5">{children}</div>;
352338
}
353339

354340
function VariableFields({
@@ -423,9 +409,9 @@ function VariableFields({
423409
/>
424410
);
425411
})}
426-
<div className={cn("flex items-center justify-between gap-4", items.length > 1 && "pr-10")}>
412+
<div className="flex items-center justify-between gap-4">
427413
<Paragraph variant="extra-small">
428-
Tip: Paste your .env into this form to populate it.
414+
Tip: Paste all your .env values at once into this form to populate it.
429415
</Paragraph>
430416
<Button
431417
variant="tertiary/medium"
@@ -471,7 +457,7 @@ function VariableField({
471457

472458
return (
473459
<fieldset ref={ref}>
474-
<FieldLayout showDeleteButton={showDeleteButton}>
460+
<FieldLayout>
475461
<Input
476462
id={`${formId}-${baseFieldName}.key`}
477463
name={`${baseFieldName}.key`}
@@ -481,22 +467,24 @@ function VariableField({
481467
autoFocus={index === 0}
482468
onPaste={onPaste}
483469
/>
484-
<Input
485-
id={`${formId}-${baseFieldName}.value`}
486-
name={`${baseFieldName}.value`}
487-
type={showValue ? "text" : "password"}
488-
placeholder="Not set"
489-
value={value.value}
490-
onChange={(e) => onChange({ ...value, value: e.currentTarget.value })}
491-
/>
492-
{showDeleteButton && (
493-
<Button
494-
variant="minimal/medium"
495-
type="button"
496-
onClick={() => onDelete()}
497-
LeadingIcon={XMarkIcon}
470+
<div className={cn("flex items-center justify-between gap-1")}>
471+
<Input
472+
id={`${formId}-${baseFieldName}.value`}
473+
name={`${baseFieldName}.value`}
474+
type={showValue ? "text" : "password"}
475+
placeholder="Not set"
476+
value={value.value}
477+
onChange={(e) => onChange({ ...value, value: e.currentTarget.value })}
498478
/>
499-
)}
479+
{showDeleteButton && (
480+
<Button
481+
variant="minimal/medium"
482+
type="button"
483+
onClick={() => onDelete()}
484+
LeadingIcon={XMarkIcon}
485+
/>
486+
)}
487+
</div>
500488
</FieldLayout>
501489
<div className="space-y-2">
502490
<FormError id={fields.key.errorId}>{fields.key.error}</FormError>

0 commit comments

Comments
 (0)