Plany: meta planu w dwoch rownych kolumnach (kalendarz lewo, inputy prawo)
This commit is contained in:
@@ -24,40 +24,51 @@ export function PlanMetaForm({
|
||||
startWeekError?: string;
|
||||
showStartWeek: boolean;
|
||||
}) {
|
||||
const titleField = (
|
||||
<Field label="Tytuł">
|
||||
<Input
|
||||
value={title}
|
||||
onChange={(e) => onTitleChange(e.target.value)}
|
||||
onBlur={onTitleBlur}
|
||||
placeholder="np. Plan masowy 8-tygodniowy"
|
||||
aria-invalid={titleError ? true : undefined}
|
||||
/>
|
||||
{titleError && <ErrorText>{titleError}</ErrorText>}
|
||||
</Field>
|
||||
);
|
||||
const weeksField = (
|
||||
<Field label="Długość (tygodnie)">
|
||||
<Select value={weeksCount} onChange={(e) => onWeeksCountChange(parseInt(e.target.value))}>
|
||||
{[1, 2, 3, 4, 5, 6, 7, 8].map((n) => (
|
||||
<option key={n} value={n}>
|
||||
{n}
|
||||
</option>
|
||||
))}
|
||||
</Select>
|
||||
</Field>
|
||||
);
|
||||
|
||||
return (
|
||||
<Card>
|
||||
{/* desktop: tytuł + długość + tydzień startu obok siebie; mobile: jedno pod drugim */}
|
||||
<div
|
||||
className={`grid grid-cols-1 sm:grid-cols-2 gap-4 items-start ${
|
||||
showStartWeek ? 'lg:grid-cols-[minmax(0,1fr)_minmax(0,1fr)_auto]' : ''
|
||||
}`}
|
||||
>
|
||||
<Field label="Tytuł">
|
||||
<Input
|
||||
value={title}
|
||||
onChange={(e) => onTitleChange(e.target.value)}
|
||||
onBlur={onTitleBlur}
|
||||
placeholder="np. Plan masowy 8-tygodniowy"
|
||||
aria-invalid={titleError ? true : undefined}
|
||||
/>
|
||||
{titleError && <ErrorText>{titleError}</ErrorText>}
|
||||
</Field>
|
||||
<Field label="Długość (tygodnie)">
|
||||
<Select value={weeksCount} onChange={(e) => onWeeksCountChange(parseInt(e.target.value))}>
|
||||
{[1, 2, 3, 4, 5, 6, 7, 8].map((n) => (
|
||||
<option key={n} value={n}>
|
||||
{n}
|
||||
</option>
|
||||
))}
|
||||
</Select>
|
||||
</Field>
|
||||
{showStartWeek && (
|
||||
{/* desktop: równe kolumny — po lewej kalendarz startu, po prawej inputy pod siebie;
|
||||
mobile (i tryb edycji bez startu): jedno pod drugim / dwa obok siebie */}
|
||||
{showStartWeek ? (
|
||||
<div className="grid grid-cols-1 lg:grid-cols-2 gap-4 items-start">
|
||||
<Field label="Tydzień startu">
|
||||
<WeekPicker value={startDate} onChange={onStartDateChange} />
|
||||
{startWeekError && <ErrorText>{startWeekError}</ErrorText>}
|
||||
</Field>
|
||||
)}
|
||||
</div>
|
||||
<div className="grid gap-4">
|
||||
{titleField}
|
||||
{weeksField}
|
||||
</div>
|
||||
</div>
|
||||
) : (
|
||||
<div className="grid grid-cols-1 sm:grid-cols-2 gap-4">
|
||||
{titleField}
|
||||
{weeksField}
|
||||
</div>
|
||||
)}
|
||||
{showStartWeek && (
|
||||
<p className="mt-3 text-dim text-[0.875rem]">
|
||||
Opcjonalnie zaznacz tydzień startu — plan zostanie od razu aktywowany (start =
|
||||
|
||||
Reference in New Issue
Block a user