The Craft’s routing is powered by React Router v6, and every page is lazy-loaded viaDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/apursley2012/the-craft/llms.txt
Use this file to discover all available pages before exploring further.
React.lazy() in assets/main.js. Adding a new page requires four coordinated changes: write the component, register a lazy import, declare a route, and optionally add a navigation entry so visitors can reach it from the moon-phase rail. The steps below walk through each one in order.
Create the page component
Create a new file inside the
assets/ directory — for example, assets/Gallery.js. All page components in The Craft follow the same shell: they wrap their content in <PageTransition>, open with a centred <header> block using the font-cinzel heading and font-garamond subtitle, then render their main content below.Add a lazy import to main.js
Open The
assets/main.js and find the block where the other pages are lazily imported — you will see nine existing React.lazy calls, one for each current page. Add your new component immediately after the last one, using the same pattern:.then(m => ({ default: m.Gallery })) transform is required because The Craft uses named exports (export function Gallery()) rather than default exports. React.lazy expects a module with a default export, so this one-liner re-shapes the module object at import time.The file name passed to
import() must match exactly — including capitalisation. './gallery.js' and './Gallery.js' are different paths on case-sensitive file systems (Linux, most production hosting environments). Use the exact same casing as the file you created in Step 1.Register the route
Still in The existing routes for reference:
assets/main.js, find the <Route path="/" element={<Layout />}> block that wraps all the existing page routes. Add your new route as a child:Add a navigation entry
Open The available phase values, and the moon shape each one renders, are:
Pick any phase that is not already used by an existing route, or intentionally re-use one if you prefer a specific icon.
components/MoonPhaseNav.js and add an entry to the navItems array:| Phase value | Appearance |
|---|---|
new | Completely dark circle |
waxing-crescent | Thin sliver lit on the right |
first-quarter | Right half lit |
waxing-gibbous | Mostly lit, small shadow on the left |
full | Fully lit circle |
waning-gibbous | Mostly lit, small shadow on the right |
last-quarter | Left half lit |
waning-crescent | Thin sliver lit on the left |
The moon-phase navigation is designed for exactly 8 routes — one per major lunar phase. If you add more than 8 routes, phases will be reused and two entries will display identical icons. For portfolios with more sections, consider extending the nav style in
MoonPhaseNav.js with a different visual indicator (a numbered badge, a sigil icon, or a text-only label) for the overflow entries.Worked Example: Adding a Gallery Page
Here is a complete before-and-after summary of the four files touched when adding a/gallery route.
assets/Gallery.js
New file. Export a
Gallery function component wrapped in <PageTransition>. Add your header and content inside.assets/main.js
Add one
React.lazy import and one <Route path="gallery" ... /> child inside the Layout route.components/MoonPhaseNav.js
Add
{ path: '/gallery', name: 'The Gallery', phase: 'full' } to the navItems array.Nothing else
No changes needed to any shared component files — the Layout and PageTransition wrappers handle everything automatically. The project ships as a pre-built static bundle, so there is no
tailwind.config.js or vite.config.js to edit in the deployed output.