Migrate server-related components to tailwind

This commit is contained in:
Alejandro Celaya
2025-04-01 11:48:35 +02:00
parent c462bc30e1
commit 06fac716d1
7 changed files with 38 additions and 31 deletions

View File

@@ -1,4 +1,4 @@
import { InputFormGroup, SimpleCard } from '@shlinkio/shlink-frontend-kit';
import { LabelledInput, SimpleCard } from '@shlinkio/shlink-frontend-kit/tailwind';
import type { FC, PropsWithChildren, ReactNode } from 'react';
import { useState } from 'react';
import { handleEventPreventingDefault } from '../../utils/utils';
@@ -18,13 +18,19 @@ export const ServerForm: FC<ServerFormProps> = ({ onSubmit, initialValues, child
return (
<form className="server-form" name="serverForm" onSubmit={handleSubmit}>
<SimpleCard className="mb-3" title={title}>
<InputFormGroup value={name} onChange={setName}>Name</InputFormGroup>
<InputFormGroup type="url" value={url} onChange={setUrl}>URL</InputFormGroup>
<InputFormGroup value={apiKey} onChange={setApiKey}>API key</InputFormGroup>
<SimpleCard className="tw:mb-4" bodyClassName="tw:flex tw:flex-col tw:gap-y-3" title={title}>
<LabelledInput label="Name" value={name} onChange={(e) => setName(e.target.value)} required />
<LabelledInput label="URL" type="url" value={url} onChange={(e) => setUrl(e.target.value)} required />
<LabelledInput
label="API key"
type="password"
value={apiKey}
onChange={(e) => setApiKey(e.target.value)}
required
/>
</SimpleCard>
<div className="text-end">{children}</div>
<div className="tw:flex tw:items-center tw:justify-end tw:gap-x-2">{children}</div>
</form>
);
};