Skip to content

5 Portals, 1 Commit: When a Design System Is Truly Data-Driven

Adityo Guni Waluyo

One commit aligns 5 service portals with a data-driven design system — shared primitives, CMS-driven icons, color-mix accents, Server Components streaming, adaptive grid.

TL;DR

Five KotaPortal portals drifted into clashing heroes, card grids, and hardcoded icons despite sharing one component. Commit 788383b fixed this by extracting shared, data-driven primitives from the gateway page, so icons and tones now derive automatically from service data. Result: five portals, one accessible design language, zero drift.

Introduction

Last week I opened all five KotaPortal service portals: pariwisata, olahraga, budaya, kepemudaan, ekraf — and each had its own hero section and card styling. Not subtle differences. The olahraga hero used solid hot pink, kepemudaan deep green, budaya purple, and so on. Loan cards in olahraga used a two-column grid, kepemudaan three columns, icons hardcoded per URL. The owner said: "cards follow the /layanan card design and the hero follows that page's design too." One commit, 788383b, all portals now speak the same design language.

The Problem: Drift Isn't Just Aesthetics

All five portals are built from the same component: BidangLayananPage. But each bidang brought its own styling — BIDANG_TONES solid color for hero, border-left block for section headings, manual icon mapping in every file. Add a new bidang? Edit code. Add a new service type via CMS? Icon doesn't appear automatically. The design system meant to create consistency became the source of drift.

The Fix: Shared Primitives That Are Data-Driven

Commit 788383b extracts primitives already living in /layanan (the public gateway page) and turns them into shared primitives: GatewayGroupHeader, GatewayCardTile, gatewayGridClass, iconForBidang, HeroBackground. All data-driven. Icons derive from the module field on serviceTypes data — pariwisata gets Compass, olahraga Trophy, budaya Palette, kepemudaan Users, ekraf Lightbulb. No if (slug === 'peminjaman-gor-stadion') return Trophy. CMS adds a new service type with module: "kepemudaan"? Card automatically gets Users icon and green tone. Zero component edits.

Why color-mix Is an Accent, Not a Background

Old hero: style={{ backgroundColor: tone.color }} — solid color block, white text. New hero: light gradient from-brand-50/70 via-white to-sky-50/40 plus HeroBackground mesh (radial-gradient layering + grid overlay via CSS background-image), serif sentence-case "Layanan Kepemudaan" in black, bidang chip uses color-mix(in srgb, ${tone.color} 10%, transparent). Tone becomes accent, not background. Contrast stays accessible, brand shows up, eyes don't tire. NN/g says a good design system "creates visual consistency across products, channels, and (potentially siloed) departments" — exactly what happened: 5 portals, 1 design language, zero drift.

Server Components Render First, Stream to Client

Next.js App Router defaults to Server Components. BidangLayananPage fetches serviceTypes on the server, renders GatewayCardTile as a Server Component, streams the RSC payload to the browser. Client only hydrates interactivity (AuthModal, wizard). RSC payload contains rendered Server Components + Client Component placeholders + props. Result: loan cards already have data when first HTML hits the browser. No loading spinner for public data.

Adaptive Grid: 4 Cards Must Not Leave 1 Hanging

gatewayGridClass(count) returns Tailwind class based on card count: 1-2 columns -> sm:grid-cols-2, 3 -> lg:grid-cols-3, 4 -> lg:grid-cols-4. 5 cards? Back to 3 columns (2+2+1 clean). Owner doctrine: "4 cards must not leave one card hanging." Grid class computed at render, not hardcoded per page.

MasukCard & CTA: Tone-Tinted Pills

Anonymous gate becomes split panel (commit 5ab80bd): left login card (lock icon + tone chip), right skeleton preview + veil (wizard not mounted, zero real input). Logged in? Wizard opens immediately. MasukCard and "Isi formulir" link use color-mix for background/border + box-shadow: 0 10px 24px -10px ${tone.color}80 for hover lift. Bidang color appears as subtle accent, not dominant.

Vitest 16/16 pass, tsc clean, lint clean. Live probe: kepemudaan hero gradient + tiles, olahraga regression clean, 0 overflow.

Sources

  1. Commit 788383b8ef7e5e507d47ab10391cde90f622ad79 — style(layanan): portal hero + cards adopt the gateway design
  2. Next.js Server Components docs — Server and Client Components
  3. NN/g Design Systems 101 — Design Systems 101

Related articles