Skip to content

Commit

Permalink
Hide labels after first row in admin
Browse files Browse the repository at this point in the history
  • Loading branch information
evadecker committed Nov 17, 2024
1 parent 1a7226d commit 7b80f44
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/loud-snakes-deny.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"namesake": minor
---

Display estimated costs for each quest
9 changes: 7 additions & 2 deletions src/routes/_authenticated/admin/quests/$questId.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,18 @@ const CostInput = memo(function CostInput({
cost,
onChange,
onRemove,
hideLabel = false,
}: {
cost: { cost: number; description: string };
onChange: (cost: { cost: number; description: string }) => void;
onRemove: (cost: { cost: number; description: string }) => void;
hideLabel?: boolean;
}) {
return (
<div className="flex items-end gap-2">
<NumberField
label="Cost"
label={hideLabel ? undefined : "Cost"}
aria-label={hideLabel ? "Cost" : undefined}
className="w-28"
prefix="$"
value={cost.cost}
Expand All @@ -70,7 +73,8 @@ const CostInput = memo(function CostInput({
}
/>
<TextField
label="For"
label={hideLabel ? undefined : "For"}
aria-label={hideLabel ? "For" : undefined}
className="w-80"
value={cost.description}
onChange={(value) => onChange({ cost: cost.cost, description: value })}
Expand Down Expand Up @@ -180,6 +184,7 @@ function AdminQuestDetailRoute() {
onRemove={() => {
setCosts(costs.filter((_, i) => i !== index));
}}
hideLabel={index > 0}
/>
))}
<Button
Expand Down

0 comments on commit 7b80f44

Please sign in to comment.