Skip to content

Commit

Permalink
refactor(frontend): refactor locate form and extract route components
Browse files Browse the repository at this point in the history
drops `react-hook-form` dependency in favor of using search params for form state
  • Loading branch information
declanlscott committed Mar 3, 2024
1 parent f391911 commit 98c4fb1
Show file tree
Hide file tree
Showing 24 changed files with 799 additions and 944 deletions.
2 changes: 1 addition & 1 deletion apps/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"@hookform/resolvers": "^3.3.4",
"@icons-pack/react-simple-icons": "^9.3.0",
"@repo/env": "workspace:*",
"@repo/schemas": "workspace:*",
"@repo/ui": "workspace:*",
"@tanstack/react-query": "^5.24.6",
"@tanstack/react-query-devtools": "^5.24.6",
Expand All @@ -28,7 +29,6 @@
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-error-boundary": "^4.0.13",
"react-hook-form": "^7.51.0",
"tailwindcss-animate": "^1.0.7",
"valibot": "^0.29.0"
},
Expand Down
13 changes: 9 additions & 4 deletions apps/frontend/src/components/error-card.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
import { Card } from "@repo/ui";
import { Card, cn } from "@repo/ui";

import { DroppedCone } from "~/components/dropped-cone";

export function ErrorCard() {
export function ErrorCard(props: { className?: string }) {
return (
<Card className="text-muted-foreground flex h-64 flex-col items-center justify-center gap-4">
<Card
className={cn(
"text-muted-foreground flex h-64 flex-col items-center justify-center gap-4",
props.className,
)}
>
<DroppedCone className="fill-muted-foreground h-28" />
{"Something went wrong..."}
Something went wrong...
</Card>
);
}
13 changes: 12 additions & 1 deletion apps/frontend/src/components/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,24 @@ export function Layout() {
) : null}

<nav className="flex items-center sm:gap-12">
<Link to="/">
<Link
to="/"
search={{ type: "address", address: "" }}
activeOptions={{ includeSearch: false }}
preload={false}
>
<Logo />
</Link>

<ul className="hidden sm:flex">
<li>
<Link
to="/"
search={{ type: "address", address: "" }}
className={linkClassNames}
inactiveProps={{ className: inactiveLinkClassNames }}
activeOptions={{ includeSearch: false }}
preload={false}
>
<Locate />
<span>Locate</span>
Expand Down Expand Up @@ -140,8 +148,11 @@ function MobileNav({ setIsVisible }: MobileNavProps) {
<li>
<Link
to="/"
search={{ type: "address", address: "" }}
className={linkClassNames}
inactiveProps={{ className: inactiveLinkClassNames }}
activeOptions={{ includeSearch: false }}
preload={false}
onClick={() => setIsVisible(false)}
>
<Locate />
Expand Down
201 changes: 0 additions & 201 deletions apps/frontend/src/components/locate-form.tsx

This file was deleted.

40 changes: 0 additions & 40 deletions apps/frontend/src/components/nearby-fods.tsx

This file was deleted.

Loading

0 comments on commit 98c4fb1

Please sign in to comment.