[WIP] Migrate /modeling to Next.js routing

Mostly easy, but with a link we needed to migrate in the `ItemCard` component! (I see one in `SquareItemCard` too, but I'll wait until it comes up.)
This commit is contained in:
Emi Matchu 2022-09-14 19:52:10 -07:00
parent 296d641c03
commit 02af99dded
3 changed files with 27 additions and 27 deletions

5
pages/modeling.tsx Normal file
View file

@ -0,0 +1,5 @@
import ModelingPage from "../src/app/ModelingPage";
export default function ModelingPageWrapper() {
return <ModelingPage />;
}

View file

@ -20,7 +20,6 @@ const ItemTradesOfferingPage = loadable(() =>
const ItemTradesSeekingPage = loadable(() =>
import("./ItemTradesPage").then((m) => m.ItemTradesSeekingPage)
);
const ModelingPage = loadable(() => import("./ModelingPage"));
const UserItemListsIndexPage = loadable(() =>
import("./UserItemListsIndexPage")
);
@ -96,11 +95,6 @@ function App() {
<UserOutfitsPage />
</PageLayout>
</Route>
<Route path="/modeling">
<PageLayout>
<ModelingPage />
</PageLayout>
</Route>
<Route path="/">
<PageLayout hideHomeLink>
<HomePage />

View file

@ -17,7 +17,7 @@ import {
StarIcon,
} from "@chakra-ui/icons";
import { HiSparkles } from "react-icons/hi";
import { Link } from "react-router-dom";
import Link from "next/link";
import SquareItemCard from "./SquareItemCard";
import { safeImageUrl, useCommonStyles } from "../util";
@ -30,26 +30,27 @@ function ItemCard({ item, badges, variant = "list", ...props }) {
return <SquareItemCard item={item} {...props} />;
case "list":
return (
<Box
as={Link}
to={`/items/${item.id}`}
display="block"
p="2"
boxShadow="lg"
borderRadius="lg"
background={brightBackground}
transition="all 0.2s"
className="item-card"
width="100%"
minWidth="0"
{...props}
>
<ItemCardContent
item={item}
badges={badges}
focusSelector=".item-card:hover &, .item-card:focus &"
/>
</Box>
<Link href={`/items/${item.id}`} passHref>
<Box
as="a"
display="block"
p="2"
boxShadow="lg"
borderRadius="lg"
background={brightBackground}
transition="all 0.2s"
className="item-card"
width="100%"
minWidth="0"
{...props}
>
<ItemCardContent
item={item}
badges={badges}
focusSelector=".item-card:hover &, .item-card:focus &"
/>
</Box>
</Link>
);
default:
throw new Error(`Unexpected ItemCard variant: ${variant}`);