Documentation Index
Fetch the complete documentation index at: https://mintlify.com/apursley2012/dev-arcade/llms.txt
Use this file to discover all available pages before exploring further.
LevelLayout is the universal page wrapper used by all seven route components in Dev Arcade. It provides two things: an arcade-styled loading screen that plays for 800ms on every page mount, and a smooth fade-plus-slide-up entrance animation for the page content that follows. Every route in the app delegates its loading state and entrance choreography entirely to this component, keeping individual pages clean and focused on their own markup.
Props
| Prop | Type | Required | Description |
|---|---|---|---|
children | ReactNode | Yes | Page content shown after loading completes |
levelName | string | Yes | Level name displayed in the loading screen beneath LOADING... |
Source
Behavior
LevelLayout operates in two sequential phases whenever a page mounts.
Phase 1 — Loading screen (0–800ms)
As soon as the component mounts, asetTimeout fires an 800ms countdown. During this window the component renders a centered loading screen that contains:
- A pulsing
LOADING...headline (using theanimate-pulseutility) followed by a line break and thelevelNamestring — for example,LOADING... / LEVEL 3: CARTRIDGE INVENTORY. - A magenta progress bar (
bg-magenta-hot) that animates its width from0%to100%linearly over 700ms, giving visitors a satisfying near-complete bar just before the content appears.
opacity: 0 on mount and fades out to opacity: 0 on exit — transitions handled by Framer Motion’s AnimatePresence at the router level.
Phase 2 — Content entrance (after 800ms)
Once the timer fires,isLoading is set to false. React unmounts the loading screen and mounts the children inside a motion.div that starts at opacity: 0, y: 20 and animates to opacity: 1, y: 0 over 400ms. The combined effect is a gentle fade-and-rise that feels natural after the loading screen departs.
Usage
LevelLayout. The levelName string appears verbatim in the loading headline, so keep it short, uppercase, and in the LEVEL N: SUBTITLE convention used by the existing pages.
The 800ms delay is intentional — it’s what gives Dev Arcade its retro “inserting a cartridge” feel. If you need to shorten or lengthen it, update the first argument to
setTimeout inside the useEffect in LevelLayout. The progress bar’s duration (currently 0.7) is a separate value and should be adjusted to stay slightly shorter than the new timer value so the bar visually “completes” just before the content appears.LevelLayout’s motion.div fits into the router-level AnimatePresence wrapper and the overall transition sequence, see the Animations architecture guide.