Plany: kalendarz startu pelna szerokosc kolumny, na mobile inputy nad kalendarzem
This commit is contained in:
@@ -3,6 +3,7 @@ import { ChevronLeft, ChevronRight } from 'lucide-react';
|
||||
import { Button } from './button';
|
||||
import { formatMonth } from '../../store/body-params';
|
||||
import { fmtDate } from '../../lib/format';
|
||||
import { cn } from '../../lib/utils';
|
||||
|
||||
const WEEK_DOWS = ['Pn', 'Wt', 'Śr', 'Cz', 'Pt', 'So', 'Nd'];
|
||||
|
||||
@@ -48,9 +49,12 @@ export function isPastWeek(monday: string): boolean {
|
||||
export function WeekPicker({
|
||||
value,
|
||||
onChange,
|
||||
className,
|
||||
}: {
|
||||
value: string;
|
||||
onChange: (monday: string) => void;
|
||||
/** Dodatkowe klasy dla roota (np. max-w-none, żeby wypełnić kontener). */
|
||||
className?: string;
|
||||
}) {
|
||||
const now = new Date();
|
||||
const [view, setView] = useState<[number, number]>(() => {
|
||||
@@ -81,7 +85,7 @@ export function WeekPicker({
|
||||
const selMondayKey = value ? localDayKey(mondayOf(parseIsoLocal(value))) : null;
|
||||
|
||||
return (
|
||||
<div className="w-full max-w-xs">
|
||||
<div className={cn('w-full max-w-xs', className)}>
|
||||
<div className="flex items-center justify-between gap-2 mb-2">
|
||||
<Button
|
||||
size="sm"
|
||||
|
||||
@@ -50,18 +50,20 @@ export function PlanMetaForm({
|
||||
|
||||
return (
|
||||
<Card>
|
||||
{/* 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 */}
|
||||
{/* desktop: równe kolumny — po lewej kalendarz startu (wypełnia kolumnę), po prawej
|
||||
inputy pod siebie; mobile: inputy nad kalendarzem; tryb edycji bez startu: 2 kolumny */}
|
||||
{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 className="grid gap-4">
|
||||
{titleField}
|
||||
{weeksField}
|
||||
</div>
|
||||
<div className="lg:order-first">
|
||||
<Field label="Tydzień startu">
|
||||
<WeekPicker value={startDate} onChange={onStartDateChange} className="max-w-none" />
|
||||
{startWeekError && <ErrorText>{startWeekError}</ErrorText>}
|
||||
</Field>
|
||||
</div>
|
||||
</div>
|
||||
) : (
|
||||
<div className="grid grid-cols-1 sm:grid-cols-2 gap-4">
|
||||
|
||||
Reference in New Issue
Block a user