Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
101 changes: 46 additions & 55 deletions src/components/PresetSelector.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

"use client";

import { useCallback, useState } from "react";
Expand Down Expand Up @@ -273,62 +274,52 @@ export default function PresetSelector({ recipe, onChange }: Props) {
</div>

{recipe.preset === "custom" && (
<div className="mt-2 flex items-center gap-4 rounded-lg border border-[var(--border)] bg-[var(--surface)] p-4 shadow-sm animate-fade-in">
<div className="flex-1">
<label
htmlFor="custom-width"
className="mb-1.5 block text-[10px] font-heading font-semibold uppercase tracking-wider text-[var(--muted)]"
>
Width
</label>
<input
id="custom-width"
type="number"
autoComplete="off"
min={16}
max={7680}
step={2}
value={recipe.customWidth}
onChange={(e) => handleWidthChange(Number(e.target.value))}
className="w-full min-w-20 rounded-md border border-[var(--border)] bg-[var(--bg)] px-3 py-2 text-sm font-heading transition-all focus:outline-none focus:ring-2 focus:ring-film-400 [appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none"
/>
</div>

<div className="flex h-full flex-col items-center justify-center">
<span className="font-heading text-sm font-medium text-[var(--muted)]">
×
</span>
</div>

<div className="flex-1">
<label
htmlFor="custom-height"
className="mb-1.5 block text-[10px] font-heading font-semibold uppercase tracking-wider text-[var(--muted)]"
>
Height
</label>
<input
id="custom-height"
type="number"
autoComplete="off"
min={16}
max={7680}
step={2}
value={recipe.customHeight}
onChange={(e) => handleHeightChange(Number(e.target.value))}
className="w-full min-w-20 rounded-md border border-[var(--border)] bg-[var(--bg)] px-3 py-2 text-sm font-heading transition-all focus:outline-none focus:ring-2 focus:ring-film-400 [appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none"
/>
<div className="mt-2 rounded-lg border border-[var(--border)] bg-[var(--surface)] p-3 shadow-sm animate-fade-in space-y-2">
<div className="flex items-end gap-2">
<div className="flex-1 min-w-0">
<label
htmlFor="custom-width"
className="mb-1.5 block text-[10px] font-heading font-semibold uppercase tracking-wider text-[var(--muted)]"
>
Width
</label>
<input
id="custom-width"
type="number"
autoComplete="off"
min={16}
max={7680}
step={2}
value={recipe.customWidth}
onChange={(e) => handleWidthChange(Number(e.target.value))}
className="w-full rounded-md border border-[var(--border)] bg-[var(--bg)] px-3 py-2 text-sm font-heading transition-all focus:outline-none focus:ring-2 focus:ring-film-400 [appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none"
/>
</div>
<span className="mb-2.5 font-heading text-sm font-medium text-[var(--muted)] shrink-0">×</span>
<div className="flex-1 min-w-0">
<label
htmlFor="custom-height"
className="mb-1.5 block text-[10px] font-heading font-semibold uppercase tracking-wider text-[var(--muted)]"
>
Height
</label>
<input
id="custom-height"
type="number"
autoComplete="off"
min={16}
max={7680}
step={2}
value={recipe.customHeight}
onChange={(e) => handleHeightChange(Number(e.target.value))}
className="w-full rounded-md border border-[var(--border)] bg-[var(--bg)] px-3 py-2 text-sm font-heading transition-all focus:outline-none focus:ring-2 focus:ring-film-400 [appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none"
/>
</div>
</div>

<div className="hidden h-full flex-col justify-end sm:flex">
<span className="mb-1.5 block text-center text-[10px] font-heading font-semibold uppercase tracking-wider text-[var(--muted)]">
Ratio
</span>
<div className="flex h-[38px] items-center rounded-md border border-[var(--border)] bg-[var(--bg)] px-3 text-xs font-medium text-film-700">
{getOrientationLabel(
recipe.customWidth || 0,
recipe.customHeight || 0,
)}
<div className="flex items-center gap-2">
<span className="text-[10px] font-heading font-semibold uppercase tracking-wider text-[var(--muted)]">Ratio</span>
<div className="flex h-[28px] items-center rounded-md border border-[var(--border)] bg-[var(--bg)] px-2.5 text-xs font-medium text-film-700">
{getOrientationLabel(recipe.customWidth || 0, recipe.customHeight || 0)}
</div>
</div>
</div>
Expand Down
Loading