Blog
EngineeringFor engineers

Making a website feel like an app

How we rebuilt the Lodge Internet website for a 360 px phone first, with colour tokens that flip for dark mode, glass bars, bottom sheets, and one Tailwind rule we learned the hard way.

Lodge Internet · 14 November 2026 · 6 min read

Scroll the hostels page on a phone. The big title slides up under the top bar, the bar frosts over with a thin line along its bottom edge, and the title reappears small in the middle of the bar. The tab bar floating at the bottom tucks its labels away. Tap a plan and a sheet rises from the bottom of the screen.

That is the Lodge Internet website, a Next.js 14 site with Tailwind, running in a phone's browser. This post is how it got there.

The problem: nobody uses the desktop view

Our customers are students buying hostel Wi-Fi codes, almost always on a phone, often a small Android one. Our engineering standards say it plainly (rule P10): every screen is designed for a 360 to 390 px phone first, then widened. Rule F5 says what "checked" means: no horizontal scroll at 360 and 390 px, tap targets of at least 44 px, headers that don't wrap badly, money figures that fit.

So we built the customer pages as a route group, app/(client), with their own design system, and left the admin screens on their own glass look. Base classes describe the phone; md: and lg: prefixes widen it.

Colour tokens that flip, so nobody writes dark:

The first decision was where colour lives. Every colour on a customer page is a CSS variable in globals.css, stored as bare RGB channels:

:root {
  --canvas: 245 245 247;   /* page grey */
  --surface: 255 255 255;  /* cards */
  --ink: 29 29 31;         /* primary text */
  --accent: 37 99 235;     /* the house blue */
}

:root[data-theme="dark"]:has(.client-root) {
  --canvas: 0 0 0;
  --surface: 28 28 30;
  --ink: 245 245 247;
}

Tailwind then maps its colour names onto those variables, canvas: "rgb(var(--canvas) / <alpha-value>)", which is why the channels are bare: opacity modifiers like bg-accent/10 keep working.

The payoff is rule F1. Client code writes bg-surface text-ink and never dark:bg-zinc-900. Dark mode is one block of variable overrides, so a new screen is dark-mode ready the moment it uses the tokens, and there is exactly one place to fix a colour that's wrong.

The :has(.client-root) part is deliberate. Dark mode only switches on while a customer page is on screen. The admin screens never read these tokens and always stay light.

A bar that turns to glass

At the top of a page the nav bar is transparent. Once the page scrolls past 4 px, NavBar.tsx swaps in a class that blurs what's behind it and draws a hairline:

.ui-glass-bar {
  background-color: rgb(var(--canvas) / 0.72);
  backdrop-filter: blur(24px) saturate(180%);
  box-shadow: inset 0 -1px 0 var(--hairline);
}

The small inline title comes from PageHeader.tsx. An IntersectionObserver watches the large title, and when it has slid up under the bar, a shared context tells the bar to fade its own copy in.

Glass is a preference, so it has fallbacks. Browsers without backdrop-filter, and anyone who has asked their phone for reduced transparency or more contrast, get a solid bar instead.

A floating tab bar on phones

Below the md breakpoint, TabBar.tsx draws four tabs (Home, Hostels, Support, Account) in a glass capsule floating above the bottom edge, clear of the phone's safe area. Scrolling down, once past the first 80 px, shrinks it and tucks the labels away; scrolling up brings them back. A selection pill slides between tabs with a slight spring.

Focused flows hide it. ClientChrome.tsx keeps a list of patterns (sign-in, registration, the plans and checkout page, maintenance) where the tab bar would only be something to tap by accident.

Bottom sheets that become cards

Sheet.tsx is one component with two shapes. On a phone it rises from the bottom with a grabber and rounded top corners. From md up, the same panel sits centred as a card:

isAlert ? "items-center p-6" : "items-end md:items-center md:p-6"

Its animation follows the same split: animate-sheet-up md:animate-pop-in. Sheets render into a portal node inside the client root, so they get the tokens, the font and dark mode even though they sit outside the page in the DOM. There is more to the sheet than looks, mostly to do with living next to the Paystack payment popup; that's in Small things that keep the website standing.

Skeletons, not spinners

Rule F4 says every data view has loading, empty and error states, and loading uses a skeleton. States.tsx holds all three. ListSkeleton draws grey rows shaped like the list that's coming, with a shimmer built from the ink token at low opacity, so it is correct in both themes without a second version. ErrorState gives every failed load a "Try again" button instead of an empty screen.

Page changes where the bars stay still

In the App Router, a layout.tsx persists across page changes and a template.tsx remounts on each one. We use both. The nav bar and tab bar live in the layout, so they never move. The template wraps only the page content:

export default function ClientTemplate({ children }: { children: ReactNode }) {
  return <div className="ui-page-in">{children}</div>;
}

ui-page-in fades the new page up 10 px. Its fill mode is backwards, not both, and that choice matters. A transform left behind on the wrapper after the animation ends would make it the containing block for every position: fixed child, and the mobile checkout bar would stop being pinned to the screen. With backwards, nothing remains once the entrance finishes. Everything also collapses to near-instant for visitors who ask for reduced motion.

Dark mode before the first paint

The visitor chooses Light, Dark or System in ThemeToggle.tsx. System means no attribute at all, and the CSS follows prefers-color-scheme. A saved Light or Dark choice becomes data-theme on <html>.

If we applied that choice from React, a visitor who picked Dark would see a white page for a beat on every load, then the flip. So the client layout inlines a tiny script that runs before the body paints:

try {
  var t = localStorage.getItem(STORAGE_KEY);
  if (t === "light" || t === "dark") document.documentElement.setAttribute("data-theme", t);
} catch (e) {}

The try is there because storage can be blocked, in which case the page simply follows the system. That inline script is also the one our script policy has to allow by nonce, which the companion post covers.

The Tailwind rule that bit us

Tailwind builds its stylesheet by scanning source files for class names as plain text. A class assembled at runtime never appears in the source, so it is never generated. The admin dashboard learned this first: its KPI tiles chose a tint with ` kpi-${tone} , the scanner saw no kpi-blue` anywhere, and the tiles silently lost their colour. No error, no warning, just plain tiles.

The fix is rule F2: map every variant to a whole literal string. Button.tsx is the pattern every component now follows:

const VARIANTS: Record<Variant, string> = {
  filled: "bg-accent text-white hover:bg-accent/90",
  tinted: "bg-accent/10 text-accent-ink hover:bg-accent/15",
  gray: "bg-ink/[0.06] text-ink hover:bg-ink/10",
  // ...
};

The same rule sits in a comment above the hostel thumbnail palettes in Monogram.tsx, the wallet card designs and the admin KPI tones. Repeating it next to each map is cheaper than finding the next blank tile.

The trade-offs

  • :has() carries the dark mode. Browsers without it stay light, which we accept.
  • Glass costs GPU time on cheap phones. The fallbacks cover people who ask for less, but not phones that are merely slow.
  • A route group with its own system means the admin screens and the customer pages look different on purpose, and some primitives exist twice.

What's still open

ErrorScreen.tsx, the screen shown when a page crashes, is shared by customer and admin pages and can render outside the client root. It still uses fixed slate colours and dark: variants, the one place in the customer flow that breaks F1. And the 360 px check in F5 is a human with a phone, not a test. If you change a screen, open it at 360 px, in both themes, before calling it done.

Last checked against the product on 14 November 2026.

More in Engineering