<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Kelvin Kiprop on Medium]]></title>
        <description><![CDATA[Stories by Kelvin Kiprop on Medium]]></description>
        <link>https://medium.com/@kelvink96?source=rss-c04ebc6450e0------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*x3yb8LjFq1AgKrVLlgC3tg.jpeg</url>
            <title>Stories by Kelvin Kiprop on Medium</title>
            <link>https://medium.com/@kelvink96?source=rss-c04ebc6450e0------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 17:16:06 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@kelvink96/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[The Case of the Blank SharePoint Page (and the Guest Who Couldn’t See It)]]></title>
            <link>https://medium.com/@kelvink96/the-case-of-the-blank-sharepoint-page-and-the-guest-who-couldnt-see-it-5997a0184a9c?source=rss-c04ebc6450e0------2</link>
            <guid isPermaLink="false">https://medium.com/p/5997a0184a9c</guid>
            <category><![CDATA[frontend-development]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[microsoft-365]]></category>
            <category><![CDATA[sharepoint]]></category>
            <category><![CDATA[troubleshooting]]></category>
            <dc:creator><![CDATA[Kelvin Kiprop]]></dc:creator>
            <pubDate>Sun, 08 Nov 2026 11:20:42 GMT</pubDate>
            <atom:updated>2026-12-02T08:52:53.301Z</atom:updated>
            <content:encoded><![CDATA[<p>SPFx web part and application customizer not loading for guest or external users, and the Public CDN fix.</p><p><strong>TL;DR:</strong> Guests can’t read your SPFx bundles from the app catalog, so the page renders blank. Enable the Public CDN with the */CLIENTSIDEASSETS origin (or grant the guest read on the app catalog), wait until it goes active, bump the version and redeploy the.sppkg, then retest as the guest in InPrivate. Ignore the ReadCacheOrCreate2 500: it&#39;s a decoy.</p><p><strong>This post assumes:</strong> a tenant-wide app catalog, includeClientSideAssets: true in config/package-solution.json, a modern SharePoint site, and a B2B guest (for example, a Gmail account). Site collection app catalogs behave differently.</p><p>We built a shiny intranet home page as an SPFx solution: a web part for the page body and an application customizer for the header and footer. Internal users loved it. Then we invited a Gmail guest to test external sharing, and they got a big beautiful nothing.</p><p>Here’s how we tracked down the culprit, the wrong turns we took, and the fix that finally worked.</p><h3>The crime scene</h3><p>For the guest, SharePoint showed its stock chrome and an empty canvas.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*2b12zncfWRKdVZXA.png" /></figure><blockquote><strong><em>Caption:</em></strong><em> What the guest sees: SharePoint chrome, empty canvas.</em></blockquote><p>The Network tab was screaming, too: a 500 on every single load.</p><pre>POST /sites/&lt;site&gt;/_api/SP.UserProfiles.PersonalCache/ReadCacheOrCreate2<br>CannotCreatePersonalSite : You do not have access to create this personal site.</pre><p>“Cannot create personal site” sounds like the smoking gun. It isn’t.</p><h3>Suspect #1: the red herring</h3><p>That call is SharePoint’s first-run-experience cache. It tries to write to the signed-in user’s OneDrive. Guests don’t have OneDrive, so it fails for every guest on every page, with or without web parts.</p><p>We kept seeing this error after the real bug was fixed. Lesson: <strong>don’t judge a fix by that 500.</strong> The only test that matters is whether the page renders.</p><h3>The real clue (hiding in the console)</h3><p>Further down the console, the browser dropped a few gems. These are the messages to search for if your page is blank:</p><pre>Refused to execute script from &#39;&lt;URL&gt;&#39; because its MIME type (&#39;text/html&#39;) is not executable, and strict MIME type checking is enabled.</pre><pre>Could not load &lt;your-component&gt; in require. Error: Script error for &quot;&lt;component-id&gt;_1.0.0&quot;</pre><pre>Uncaught (in promise) Error: Failed to create application customizer &#39;ClientSideExtension.ApplicationCustomizer.&lt;id&gt;&#39;. Error information is &#39;Extension failed to load for componentId &quot;&lt;id&gt;&quot;.&#39;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*b31hiO4ynbDLRrXWEFF4aQ.png" /></figure><blockquote><strong><em>Caption:</em></strong><em> One decoy, one real clue, and the symptoms it caused.</em></blockquote><p>The Refused to execute line is the one that matters. In DevTools it may show &lt;URL&gt;, so expand the message or open the Network tab to see the full address. The full message looks like this:</p><pre>Refused to execute script from<br>&#39;https://&lt;tenant&gt;.sharepoint.com/sites/appcatalog/_layouts/15/AccessDenied.aspx?Source=...<br>/sites/appcatalog/ClientSideAssets/.../my-web-part_&lt;hash&gt;.js&#39;<br>because its MIME type (&#39;text/html&#39;) is not executable</pre><p>Translation: the browser requested the web part’s JavaScript but received an “Access Denied” page instead. The Source= parameter tells you exactly which file it wanted.</p><p>So what’s going on?</p><ul><li>With includeClientSideAssets: true in config/package-solution.json, the .sppkg carries its JS bundles.</li><li>Deploy it to the tenant app catalog and those bundles live in that site’s ClientSideAssets library.</li><li>By default, pages load them straight from there.</li><li>Your internal people can read the app catalog site. Your guest cannot. Door closed, page blank.</li><li>Both the web part and the application customizer load this way, so both fail together.</li></ul><h3>Suspect #2: the Private CDN (a swing and a miss)</h3><p>Our first idea: turn on the Office 365 <strong>Private</strong> CDN and add */CLIENTSIDEASSETS as an origin.</p><pre>Set-SPOTenantCdnEnabled -CdnType Private -Enable $true<br>Add-SPOTenantCdnOrigin -CdnType Private -OriginUrl */CLIENTSIDEASSETS</pre><p>We waited out the “(configuration pending)” status. We redeployed the package. We refreshed like champions. Same /sites/appcatalog/ClientSideAssets/ URLs, same AccessDenied.</p><p>The Private CDN simply doesn’t take over these bundles. No amount of waiting or redeploying was going to change that. Moving on.</p><h3>The fix: the Public CDN</h3><p>SPFx ClientSideAssets get served from the <strong>Public</strong> CDN, where */CLIENTSIDEASSETS is a standard origin. Flip that on and the guest&#39;s page springs to life.</p><ol><li><strong>Check the current state first.</strong> You need the SharePoint Administrator or Global Administrator role. The Public CDN may already be enabled on your tenant, in which case the problem is a missing origin or a package deployed before it went live.</li></ol><pre>Connect-SPOService -Url https://-admin.sharepoint.com Get-SPOTenantCdnEnabled -CdnType Public Get-SPOTenantCdnOrigins -CdnType Public</pre><p><strong>2. Enable it if it’s off.</strong></p><pre>Set-SPOTenantCdnEnabled -CdnType Public -Enable $true</pre><p><strong>3. Check that</strong> */CLIENTSIDEASSETS <strong>is in the Public origins list.</strong> If it&#39;s missing, add it:</p><pre>Add-SPOTenantCdnOrigin -CdnType Public -OriginUrl */CLIENTSIDEASSETS</pre><p><strong>4. Grab a coffee</strong> until “(configuration pending)” disappears. Think roughly 15 minutes.</p><p><strong>5. Redeploy the</strong> .sppkg<strong>.</strong> Bump the version, rebuild, upload to the app catalog, click <strong>Deploy</strong>. Asset URLs are baked in at deploy time, so a package deployed before the origin went live keeps its old, broken URLs.</p><p><strong>6. Test as the guest</strong> in an InPrivate window with DevTools open and <strong>Disable cache</strong> ticked.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*VDjTSGfSpxSQ_R7U.png" /></figure><p>The app catalog path returns an Access Denied page the browser refuses to run; the Public CDN path serves the script.</p><p>The page rendered. Victory dance optional but encouraged.</p><h3>How you know it worked</h3><p>Don’t trust a hunch. Check all three:</p><ul><li><strong>The page renders</strong> for the guest, web part, and header and footer included.</li><li><strong>The Network tab</strong> shows the bundle requests going to publiccdn.sharepointonline.com and returning 200, instead of /sites/appcatalog/ClientSideAssets/.</li><li><strong>The console</strong> no longer shows Refused to execute script.</li></ul><p>The ReadCacheOrCreate2 500 will still be there. That&#39;s expected. Remember the decoy.</p><h3>Plan B: just let the guest in</h3><p>You can also add the guest as a Visitor on the app catalog site (Active sites &gt; appcatalog &gt; Membership &gt; Visitors). It’s a great way to confirm your diagnosis in two minutes, and it’s fine for a handful of trusted guests. But it doesn’t scale: you’re opening up a site you probably want private, one guest at a time.</p><h3>Plan C: host the bundles yourself</h3><p>If your tenant admin won’t enable the Public CDN, you can serve the bundles from somewhere else. Set includeClientSideAssets to false, set a cdnBasePath in config/write-manifests.json, and upload the built files to a host that allows anonymous reads, such as Azure Blob Storage behind Azure CDN. Then deploy the package as usual. The same warning applies: whatever is anonymously readable is public.</p><h3>Read this before you flip the switch</h3><ul><li><strong>Your bundles become publicly fetchable.</strong> Anyone with the CDN URL can download the JavaScript without signing in. The URLs are hard to guess, but they are not secret, so treat them as public. Keep secrets, API keys, and private tenant data out of your bundle. (Ours holds no keys; a backend proxy does.)</li><li><strong>It’s tenant-wide.</strong> The CDN applies to every SPFx solution in the tenant, and Microsoft itself warns it sits outside the usual Microsoft 365 compliance boundary. Check with whoever owns your data policy.</li><li><strong>Order matters.</strong> Enable the origin, let it go active, then deploy the package.</li></ul><h3>The cheat sheet</h3><ol><li>Ignore ReadCacheOrCreate2 for guests. It&#39;s a decoy.</li><li>Hunt for Refused to execute script ... AccessDenied.aspx in the console.</li><li>Read the Source= URL to see where the bundle is being served from.</li><li>If it’s /sites/&lt;appcatalog&gt;/ClientSideAssets/..., the guest can&#39;t reach it. Either serve it from the Public CDN, host it yourself, or grant read access on the app catalog.</li><li>Check Get-SPOTenantCdnEnabled -CdnType Public and the origins list before changing anything.</li><li>After every change, redeploy the package and retest in a fresh InPrivate window.</li></ol><p>Happy shipping, and may your canvases never be blank.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5997a0184a9c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[PatternBase: 54 AI UX Patterns for React Developers]]></title>
            <link>https://blog.stackademic.com/patternbase-54-ai-ux-patterns-for-react-developers-7a26b3707c10?source=rss-c04ebc6450e0------2</link>
            <guid isPermaLink="false">https://medium.com/p/7a26b3707c10</guid>
            <category><![CDATA[ai-patterns]]></category>
            <category><![CDATA[mantine]]></category>
            <category><![CDATA[ai-component]]></category>
            <category><![CDATA[ant-design]]></category>
            <category><![CDATA[shadcn]]></category>
            <dc:creator><![CDATA[Kelvin Kiprop]]></dc:creator>
            <pubDate>Wed, 16 Sep 2026 11:09:15 GMT</pubDate>
            <atom:updated>2026-09-16T14:15:16.829Z</atom:updated>
            <content:encoded><![CDATA[<p>Every developer building AI features eventually runs into the same problem:</p><p>You start with a text input and a submit button.</p><p>A few weeks later, you need:</p><ul><li>Prompt suggestions</li><li>Regenerate actions</li><li>Model selection</li><li>Attachments</li><li>Citations</li><li>Streaming responses</li><li>Variations</li><li>Cost estimates</li><li>AI disclosure</li><li>Memory controls</li><li>Verification steps</li></ul><p>And suddenly you’re not building one AI feature anymore. You’re building an entire AI interface system.</p><p>That’s the idea behind <strong>PatternBase</strong>: an open source, copy-and-paste React component library implementing <strong>54 AI UX patterns</strong>, sourced from <a href="https://www.shapeof.ai/">shapeof.ai</a>’s taxonomy, across <strong>Ant Design, Mantine, and shadcn/ui</strong>, with a shared TypeScript API.</p><p><a href="https://pattern-base.netlify.app/"><strong>Browse all 54 patterns →</strong></a></p><figure><img alt="PatternBase: 54 AI UX patterns, 3 UI frameworks, one shared TypeScript API." src="https://cdn-images-1.medium.com/max/1024/1*GT4VGa_TZ9cNAppZB0VVNg.png" /><figcaption>PatternBase: 54 AI UX patterns, 3 UI frameworks, one shared TypeScript API.</figcaption></figure><h3>AI products keep reinventing the same UI</h3><p>Most AI applications look different on the surface, but underneath they share the same interaction patterns.</p><p>A coding assistant:</p><pre>Prompt input<br>Suggestions<br>Attachments<br>Streaming response<br>Citations<br>Regenerate</pre><p>A writing assistant:</p><pre>Prompt input<br>Tone controls<br>Variations<br>Rewrite actions<br>Disclosure</pre><p>An AI agent:</p><pre>Prompt input<br>Memory<br>Verification<br>Action plans<br>References</pre><p>These aren’t random UI elements. They’re recurring patterns, and <a href="https://www.shapeof.ai/">shapeof.ai</a> has already done the work of cataloguing them from a design perspective. PatternBase takes that taxonomy and answers the question developers actually have:</p><blockquote><em>How do we turn these patterns into components you can actually drop into a codebase?</em></blockquote><h3>Why I built PatternBase</h3><p>I work mostly with React ecosystems: Ant Design, Mantine, shadcn/ui, Next.js, TypeScript.</p><p>One thing I kept noticing: switching UI libraries meant rebuilding the same interaction logic. A team on Ant Design builds &lt;Citation /&gt;. A team on Mantine builds the same concept from scratch. A team on shadcn/ui does it again. The visual implementation changes. The interaction pattern doesn&#39;t.</p><p>PatternBase separates those concerns:</p><pre>AI Pattern<br>      ↓<br>Shared TypeScript API<br>      ↓<br>Ant Design · Mantine · shadcn/ui</pre><p>So instead of rebuilding &lt;Citation /&gt;, &lt;Disclosure /&gt;, and &lt;Verification /&gt; for every UI stack, you think in terms of the pattern once and swap implementations underneath it.</p><h3>What’s inside</h3><p>54 patterns, grouped into five categories:</p><h3>Prompt Actions</h3><p>Actions users ask AI to perform: OpenInput, Regenerate, Transform, Expand, Summary, Describe, Restructure, Restyle, and more.</p><h3>Wayfinders</h3><p>Patterns that help users discover what AI can do: Suggestions, FollowUp, Templates, Gallery, PromptDetails, Randomize.</p><h3>Tuners</h3><p>Controls that adjust AI behavior: ParameterControl, ModelManagement, Attachments, Filters, Modes, PromptEnhancer, VoiceAndTone.</p><h3>Governors</h3><p>Patterns that provide visibility and control: Citation, StreamOfThought, Variations, CostEstimate, References, Verification, Memory.</p><h3>Trust Builders</h3><p>Patterns that improve transparency: Disclosure, Caveat, Consent, DataOwnership, Footprints, IncognitoMode, Watermark.</p><h3>One pattern, three renders</h3><p>Every pattern component has identical props across all three frameworks. Pick your UI library, the API doesn’t change:</p><pre>// Ant Design<br>import { OpenInput, Suggestions } from &quot;@patternbase/antd&quot;;</pre><pre>// Mantine<br>import { OpenInput, Suggestions } from &quot;@patternbase/mantine&quot;;</pre><pre>// shadcn/ui<br>import { OpenInput, Suggestions } from &quot;@patternbase/shadcn&quot;;</pre><p>The goal isn’t to hide the UI library. It’s to give AI interactions a shared vocabulary that survives a framework switch.</p><p>You can see this live on the <a href="https://pattern-base.netlify.app/">docs site</a>: every pattern page has a framework toggle, so you can flip between Ant Design, Mantine, and shadcn/ui and watch the same component render again in each one.</p><figure><img alt="The same Suggestions pattern, rendered in Mantine. One click away from Ant Design or shadcn/ui." src="https://cdn-images-1.medium.com/max/1024/1*da9PUdDekj2Wd6ko7GxmZg.png" /><figcaption>The same Suggestions pattern, rendered in Mantine. One click away from Ant Design or shadcn/ui.</figcaption></figure><h3>How it works: copy, not install</h3><p>PatternBase isn’t an npm package you add to package.json. It&#39;s a copy and paste library, closer to shadcn/ui&#39;s model than to a traditional component library:</p><ol><li>Find a pattern on the <a href="https://pattern-base.netlify.app/patterns">docs site</a>.</li><li>Open the <strong>Code</strong> tab and pick your framework (Ant Design, Mantine, or shadcn/ui).</li><li>Copy the component into your project.</li></ol><figure><img alt="Every pattern ships with a live preview and a snippet ready to copy. No install step." src="https://cdn-images-1.medium.com/max/1024/1*6_wznXv7IbhPnr7hj7cnag.png" /><figcaption>Every pattern ships with a live preview and a snippet ready to copy. No install step.</figcaption></figure><p>The code is yours from that point. No version to bump, no library update that silently changes behavior under you. @patternbase/core holds the types, hooks, and utilities that don&#39;t depend on any single framework, the ones the copied components lean on, so bring that dependency in as needed.</p><h3>The architecture</h3><p>PatternBase is a pnpm workspace / Turborepo monorepo:</p><pre>packages/<br>  core/      types, hooks, state management (not tied to a framework)<br>  antd/      Ant Design implementations<br>  mantine/   Mantine implementations<br>  shadcn/    shadcn/ui implementations</pre><pre>apps/<br>  docs/      live pattern previews, prop tables, code snippets</pre><p>@patternbase/core keeps interaction logic separate from rendering, so a Citation component in Ant Design and a Citation component in shadcn/ui share the same underlying hooks. They just render differently.</p><h3>Why not just build these yourself?</h3><p>You can, and most teams do. But AI interfaces are developing their own vocabulary, much like web apps eventually standardized on tables, modals, forms, and notifications. AI products are converging around open inputs, suggestions, citations, variations, verification, memory, disclosure.</p><p>The more these patterns repeat, the more useful it is to have a copy-and-paste reference for each one: implemented once per framework, documented, and ready to adapt rather than started from a blank file.</p><h3>Try it</h3><ul><li><strong>Docs &amp; live previews:</strong> <a href="https://pattern-base.netlify.app/">pattern-base.netlify.app</a></li><li><strong>Source:</strong> <a href="https://github.com/design-sparx/pattern-base">github.com/design-sparx/pattern-base</a></li><li><strong>Taxonomy this is built on:</strong> <a href="https://www.shapeof.ai/">shapeof.ai</a></li></ul><p>This is a project still in its early days: one contributor, actively growing. If you’re building AI products with React, I’d love to hear which patterns you keep rebuilding, and which ones are missing.</p><p>MIT licensed. Contributions welcome.</p><h3>Before you go</h3><ul><li>Please take a moment to like the post and follow the writer!</li><li>Did you know that over 400,000 developers share what they’re building, learning, and discovering across our platforms every month? Learn how you can contribute <a href="https://plainenglish.io/write-for-us">here</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7a26b3707c10" width="1" height="1" alt=""><hr><p><a href="https://blog.stackademic.com/patternbase-54-ai-ux-patterns-for-react-developers-7a26b3707c10">PatternBase: 54 AI UX Patterns for React Developers</a> was originally published in <a href="https://blog.stackademic.com/">Stackademic</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building Trust Through Transparency: Why Mifugo Added a Public Status Page]]></title>
            <link>https://blog.stackademic.com/building-trust-through-transparency-why-mifugo-added-a-public-status-page-590c8d30040c?source=rss-c04ebc6450e0------2</link>
            <guid isPermaLink="false">https://medium.com/p/590c8d30040c</guid>
            <category><![CDATA[mifugo]]></category>
            <category><![CDATA[case-study]]></category>
            <category><![CDATA[monitoring]]></category>
            <category><![CDATA[better-stack]]></category>
            <dc:creator><![CDATA[Kelvin Kiprop]]></dc:creator>
            <pubDate>Mon, 10 Aug 2026 05:48:56 GMT</pubDate>
            <atom:updated>2026-08-14T07:13:20.980Z</atom:updated>
            <content:encoded><![CDATA[<p>When you’re building software for farmers, you’re building software for people whose livelihood depends on it. A feed log missed at 6 AM isn’t just a UI bug; it’s a real cost. A sales entry that fails to save during market hours isn’t a minor inconvenience; it’s lost revenue.</p><p>That’s the lens through which we build <a href="https://mifugo.app/">Mifugo</a>, our livestock management platform for small-scale Kenyan farmers. And it’s why, when it came time to pick a monitoring and status-page solution, we made a very deliberate choice.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sfRSbA3xSFDql8NEHrN51w.png" /></figure><h3>The Trust Problem</h3><p>Here’s a scenario we take seriously: a farmer opens Mifugo at 7 AM to log yesterday’s egg collection. They get a 502. They can’t enter their data. They assume the app is broken and switch to a notebook. Three weeks later, they’re still using the notebook.</p><p>For a SaaS product serving users on unreliable networks, perceived reliability is as important as actual reliability. If users don’t know whether an outage is real or just a blip, they lose confidence. A public status page flips that dynamic: instead of farmers assuming the app is broken, they see “Incident: Database migration in progress, ETA 45m” and know to check back.</p><h3>Choosing Better Stack Over Cronitor</h3><p>Mifugo spans six web products plus an API health endpoint, so we needed seven uptime monitors. We evaluated the two obvious candidates: Better Stack (formerly Better Uptime) and Cronitor.</p><p><strong>Scale first.</strong> Cronitor’s free tier maxes out at 5 monitors. Better Stack’s free tier includes 10. For our seven monitors, Better Stack covers us entirely at no cost. Cronitor’s next tier starts at $5 per monitor per month; $35/month minimum before adding users.</p><p><strong>Bundled value matters.</strong> Better Stack’s free tier includes uptime monitoring, a public status page, email and Slack alerts, incident timelines, and on-call scheduling. Cronitor charges separately for equivalent features or doesn’t include observability like logs and traces. For a growing platform, Better Stack is the more coherent choice.</p><p><strong>The UX seals it.</strong> Better Stack’s status page templates are genuinely good out of the box. Customizing ours to match Mifugo’s forest-green brand (#40916c) took minutes, not hours.</p><h3>What We Built</h3><p>We integrated Better Stack across all Mifugo products by adding a live status indicator in every user-facing footer. The indicator links directly to status.mifugo.app and updates in real time.</p><p>The integration covers:</p><ul><li>The marketing landing page footer</li><li>The authenticated farm app’s public footer</li><li>The sign-in page header</li><li>A clickable green status dot that always lets users investigate an issue without hunting for the right link</li></ul><h3>Design Decisions</h3><p>Three deliberate choices shaped our implementation:</p><p><strong>1. The Status Indicator Should Be Alive, Not Static</strong></p><p>Before Better Stack, the landing footer had a green dot and “All systems operational” text, but it wasn’t clickable. That’s a missed opportunity. A status indicator that can’t be investigated becomes wallpaper. We made it clickable so one tap takes users directly to the status page.</p><p><strong>2. The Link Should Be Everywhere a User Might Look</strong></p><p>A farmer encountering an issue should find the status page in under two seconds, whether they’re on the sign-in page, the app, or the landing site. We added System Status links across all public-facing surfaces so there’s no hunting.</p><p><strong>3. Environment Variables Should Have Safe Defaults</strong></p><p>The status page URL defaults to <a href="https://status.mifugo.app/">https://status.mifugo.app</a> when unset. This means the links work in local development without any configuration, and a missing deployment env var won’t break the footer — it just falls back to production. Small detail, zero friction.</p><h3>The Bigger Picture: Observability as a Feature</h3><p>This work is small in lines of code but represents a shift in how we think about platform health.</p><p>For the first few months, Mifugo’s reliability was a silent assumption. If things were working, users didn’t think about it. If things broke, they filed feedback or switched to pen and paper. A public status page changes that relationship: we’re no longer asking users to trust that we’re reliable; we’re showing them.</p><p>And for the engineering team, Better Stack’s alerting means we know about incidents before the first support email arrives. The Slack integration fires the moment a monitor goes down, not when a farmer tweets about it.</p><h3>What’s Next</h3><p>If you’re building a product where downtime has real-world consequences- farmers missing feed logs, clinics missing patient entries, logistics teams missing dispatch updates- a public status page isn’t overhead. It’s part of the product.</p><p>Check out Mifugo at mifugo.app and the status page at status.mifugo.app.</p><p>Mifugo is built with Next.js, Mantine, Ionic React, Supabase, and Prisma, and a lot of empathy for the people who actually use it.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=590c8d30040c" width="1" height="1" alt=""><hr><p><a href="https://blog.stackademic.com/building-trust-through-transparency-why-mifugo-added-a-public-status-page-590c8d30040c">Building Trust Through Transparency: Why Mifugo Added a Public Status Page</a> was originally published in <a href="https://blog.stackademic.com/">Stackademic</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Parse Pal: Open Source PDF Chat App Built with Next.js, Neon, Chroma, and Cloudinary]]></title>
            <link>https://blog.stackademic.com/parse-pal-open-source-pdf-chat-app-built-with-next-js-neon-chroma-and-cloudinary-3d3b56095e8e?source=rss-c04ebc6450e0------2</link>
            <guid isPermaLink="false">https://medium.com/p/3d3b56095e8e</guid>
            <category><![CDATA[open-source]]></category>
            <category><![CDATA[neondb]]></category>
            <category><![CDATA[cloudinary]]></category>
            <category><![CDATA[chromadb]]></category>
            <category><![CDATA[nextjs]]></category>
            <dc:creator><![CDATA[Kelvin Kiprop]]></dc:creator>
            <pubDate>Fri, 20 Mar 2026 12:38:13 GMT</pubDate>
            <atom:updated>2026-03-20T12:38:13.914Z</atom:updated>
            <content:encoded><![CDATA[<p>If you have ever dropped a long PDF into an AI tool and hoped for the best, you already know the problem: the answer might sound confident, but you still do not know what the app is doing behind the scenes, where your files go, or how hard it would be to adapt the workflow to your own needs.</p><p>That is the gap Parse Pal is trying to close.</p><p>Parse Pal is an open-source app for turning PDFs into a chat experience backed by retrieval. You can upload a document, ingest it, and ask questions against the content instead of guessing or manually scanning page after page. Under the hood, the project is built with a modern, practical stack: a Next.js web app, a CLI for local and admin workflows, shared retrieval logic in a reusable package, and hosted infrastructure for storage, state, and vector search.</p><h4>TL;DR</h4><ul><li>Parse Pal is an open-source app for chatting with PDF documents using retrieval.</li><li>It is built for a real hosted workflow, not just a throwaway demo</li><li>The stack combines Next.js, Cloudinary, Neon, Chroma, and a shared RAG package</li><li>Developers can study it, fork it, self-host it, or contribute to it</li><li>Try the app here: <a href="https://parse-palweb-production.up.railway.app/">https://parse-palweb-production.up.railway.app/</a></li><li>Explore the code here: <a href="https://github.com/design-sparx/parse-pal">https://github.com/design-sparx/parse-pal</a></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aYTZLee-HZ9Y_YiV-l0Y8Q.png" /><figcaption>A polished product screenshot of the main app view.</figcaption></figure><h3>Why We Built It</h3><p>A lot of document-chat demos look magical for five minutes and frustrating after that. They often hide the ingest flow, treat documents as disposable one-offs, or make it difficult to understand how retrieval is scoped.</p><p>Parse Pal takes a more grounded approach:</p><ul><li>PDF uploads are handled through a hosted web flow</li><li>Ingestion runs asynchronously instead of blocking the whole experience</li><li>Conversation, document, and job state are stored explicitly</li><li>Retrieval is scoped to the relevant document instead of relying on a destructive single-document model</li><li>The same project also includes a CLI surface for local or admin use cases</li></ul><p>That combination makes the app more useful for real projects, not just quick demos.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TS4peXj1g718XHDhmuXX-A.png" /><figcaption>A simple diagram with 4 steps: Upload PDF, Process Document, Store Embeddings, Ask Questions</figcaption></figure><h3>What Makes Parse Pal Interesting</h3><p>There are plenty of AI wrappers available online. What makes an open source project worth paying attention to is not just that it uses AI, but that it gives you a clean place to start building your own version.</p><p>Parse Pal is interesting because it is opinionated in the right places:</p><ul><li>The web app is designed for a hosted workflow, with direct upload, signing, and readiness polling</li><li>The data flow is explicit, which makes the system easier to reason about</li><li>The retrieval layer is shared, so the app and CLI do not drift apart</li><li>The architecture is modular enough to extend without rewriting everything</li></ul><p>If you are a developer exploring RAG, document intelligence, or AI-assisted knowledge tools, that matters. You are not just getting a chatbot. You are getting a working reference for structuring one.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-6mNOqJQlduLaACedkA1xQ.png" /><figcaption>A clean architecture diagram. Show the browser talking to the Next.js app, which connects to Neon for state, Cloudinary for PDFs, and Chroma for vectors</figcaption></figure><h3>A Practical Stack for Document Chat</h3><p>Parse Pal uses a stack that is practical for a real document-AI product, not just a quick prototype. Each piece has a clear job:</p><ul><li>Next.js powers the web app because it gives us a strong foundation for building the hosted product experience, including routes, server-side logic, API endpoints, and a UI layer that is easy to extend</li><li>Cloudinary handles PDF storage and delivery, so uploads can happen directly from the browser in a cleaner, more scalable way</li><li>Neon stores conversation, document, and ingest job state so the app can track what was uploaded, what is still processing, and when a document is ready for chat</li><li>Chroma handles vector storage, which makes retrieval possible once the document has been chunked and embedded</li><li>The shared RAG package keeps embeddings, retrieval logic, vector-store integration, and Chroma configuration in one place, so both the web app and CLI can use the same core behavior</li></ul><p>The reason this stack works well is that it separates responsibilities cleanly. Next.js owns the product surface. Cloudinary owns file storage. Neon owns the application state. Chroma owns the retrieval data. The shared RAG package connects those pieces without forcing everything into one tangled code path.</p><p>That separation is useful for contributors, too. It means the project is easier to understand, easier to debug, and easier to extend when someone wants to improve the UI, swap infrastructure, or experiment with retrieval quality.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iyjnIuuFvTs__Z5cHAEEvQ.png" /><figcaption>A screenshot of the repo tree or a tidy code snippet that shows apps/web, apps/cli, and packages/rag</figcaption></figure><h3>Who This Project Is For</h3><p>Parse Pal is a strong fit for:</p><ul><li>Developers learning how to build a document chat workflow end-to-end</li><li>Indie hackers who want a starting point for a PDF Q&amp;A product</li><li>Teams prototyping internal knowledge tools</li><li>open source contributors who want a practical AI app to improve</li></ul><p>It is also a good example for people who want to study the tradeoffs behind ingest pipelines, hosted uploads, and retrieval scoping without starting from a blank repo.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BQIIZCF_MtbWVOLjsjMe0g.png" /><figcaption>A real chat screenshot with 2 or 3 useful questions and answers from a sample PDF</figcaption></figure><h3>Why Open Source Matters Here</h3><p>AI products become much more valuable when people can inspect, adapt, and improve them.</p><p>With Parse Pal, open source means you can:</p><ul><li>Understand how the ingest pipeline is wired</li><li>Swap infrastructure choices to fit your stack</li><li>Improve the UI and conversation experience</li><li>Experiment with better retrieval and chunking strategies</li><li>Use the CLI and shared package as building blocks for new workflows</li></ul><p>That is a better story than “here is another black-box AI tool.” It invites people to use the project, learn from it, and contribute back to it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wi4pA9ni6EI7PV1NvreQJQ.png" /><figcaption>A GitHub screenshot is enough here</figcaption></figure><h3>Where Parse Pal Can Grow</h3><p>The most exciting part of a project like this is not just what it already does, but what it enables next.</p><p>Potential directions include:</p><ul><li>better source citation and answer grounding</li><li>richer document management for multi-file workflows</li><li>team or workspace collaboration features</li><li>evaluation tooling for retrieval quality</li><li>improved onboarding for self-hosting and contributors</li></ul><p>That makes Parse Pal useful both as a product and as a foundation for experimentation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OVjk9DaQAlU8ferWzTpbFw.png" /><figcaption>A simple roadmap card or illustrated checklist of upcoming ideas</figcaption></figure><h3>Try Parse Pal or Contribute</h3><p>If you have been looking for an open source PDF chat app you can actually learn from, Parse Pal is worth a look.</p><p>Use it to explore your own documents. Read the code to understand the architecture. Fork it if you want to build your own document assistant. Contribute if you want to help improve the open source AI tooling ecosystem.</p><p>Live app: <a href="https://parse-palweb-production.up.railway.app/">https://parse-palweb-production.up.railway.app/</a></p><p>GitHub: <a href="https://github.com/design-sparx/parse-pal">https://github.com/design-sparx/parse-pal</a></p><p>Projects like this are how better AI software gets built: in public, with real tradeoffs, by people willing to make the internals understandable.</p><p>Parse Pal is a solid step in that direction.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3d3b56095e8e" width="1" height="1" alt=""><hr><p><a href="https://blog.stackademic.com/parse-pal-open-source-pdf-chat-app-built-with-next-js-neon-chroma-and-cloudinary-3d3b56095e8e">Parse Pal: Open Source PDF Chat App Built with Next.js, Neon, Chroma, and Cloudinary</a> was originally published in <a href="https://blog.stackademic.com/">Stackademic</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building a Modern Browser-Based Code Editor]]></title>
            <link>https://blog.stackademic.com/building-a-modern-browser-based-code-editor-c9b016ea3a3b?source=rss-c04ebc6450e0------2</link>
            <guid isPermaLink="false">https://medium.com/p/c9b016ea3a3b</guid>
            <category><![CDATA[code-editor]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[radix]]></category>
            <category><![CDATA[indexeddb]]></category>
            <category><![CDATA[codemirror]]></category>
            <dc:creator><![CDATA[Kelvin Kiprop]]></dc:creator>
            <pubDate>Sun, 25 Jan 2026 12:06:57 GMT</pubDate>
            <atom:updated>2026-01-25T19:19:28.836Z</atom:updated>
            <content:encoded><![CDATA[<p><em>A deep dive into creating a VS Code-inspired development environment using cutting-edge web technologies</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yfzdTSGaSQIBCKdf52X8xg.png" /><figcaption>Screenshot of home Page with recent created projects</figcaption></figure><h3>TL;DR</h3><p><strong>Code Editor X</strong> is a VS Code-inspired, browser-based code editor built with <strong>React 19</strong>, <strong>TypeScript</strong>, <strong>CodeMirror 6</strong>, <strong>Tailwind CSS 4</strong>, and <strong>Radix UI</strong>.</p><p><strong>What it does:</strong> Multi-file editing with tabs and a file tree, syntax highlighting for multiple languages, an AI chat assistant, a project dashboard, persistent local storage, and full customization.</p><p><strong>Why it matters:</strong> Zero installation, lightweight, works on any device, built on modern tech, accessible by design.</p><p>Github repo , <a href="https://github.com/design-sparx/code-editor-x">https://github.com/design-sparx/code-editor-x</a></p><h3>Introduction</h3><p>The browser has become a legitimate platform for serious software development. Code Editor X is a modern, browser-based code editor built from the ground up with React 19, TypeScript, and CodeMirror 6.</p><h3>Why I Built This</h3><p>I wanted to code from anywhere, my laptop, a borrowed computer, even a tablet, without installing anything. Traditional IDEs are powerful but heavy. They assume you have a dedicated machine with gigabytes to spare.</p><p>I also wanted to learn. React 19 had just landed with its concurrent rendering improvements. CodeMirror 6 promised blazing-fast editing. Tailwind CSS 4 was out. Building a code editor felt like the perfect way to push these technologies to their limits and understand them deeply.</p><p>Code Editor X started as an answer to a simple question: <em>What if VS Code lived entirely in your browser?</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/1*iuqqV8lPodjBxH8n61C77A.gif" /><figcaption>GIF of settings theme toggle</figcaption></figure><h3>Who Is This For?</h3><ul><li><strong>Students , </strong>No setup , open browser, start coding</li><li><strong>Prototypers , </strong>Lightweight environment for quick ideas</li><li><strong>Teachers , </strong>Same environment for everyone, no “works on my machine”</li><li><strong>Remote workers , </strong>Access projects from any device</li></ul><h3>The Tech Stack</h3><p>Every choice was deliberate.</p><h4>React 19 + TypeScript</h4><p>Concurrent rendering handles complex UI updates smoothly , multiple resizable panels, real-time syntax highlighting, instant theme switching. TypeScript catches bugs at compile time and serves as living documentation.</p><h4>CodeMirror 6</h4><p>The editor’s heart. CM6 was rewritten from scratch for performance:</p><ul><li><strong>Compartments</strong> for dynamic reconfiguration without recreating the editor</li><li><strong>Extensible</strong> architecture, every feature is a module</li><li><strong>Mobile-friendly,</strong> unlike many competitors</li></ul><pre>// Switch themes without recreating the editor<br>const themeCompartment = new Compartment();<br>view.dispatch({<br>  effects: themeCompartment.reconfigure(newTheme)<br>});</pre><h4>Radix UI + Tailwind CSS 4</h4><p>Radix provides accessible component primitives (dialogs, dropdowns, tooltips) that work with screen readers and keyboard navigation. Tailwind makes styling fast and consistent.</p><h4>IndexedDB + React Context</h4><p>Offline-first persistence with IndexedDB: your work stays local, you own your data. React Context manages theme, settings, and project state without external dependencies.</p><h3>What We’ve Built</h3><h4>The Layout</h4><p>All panels are resizable, collapsible, and remember their state across sessions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xi3UWgiAd0hPlXtskOaaug.png" /><figcaption>Screenshot of editor page with all panels</figcaption></figure><h4>Core Features</h4><ul><li><strong>File Tree</strong>: Hierarchical navigation with language-specific icons, create/rename/delete operations</li><li><strong>Multi-Tab Editing</strong>: Dirty state indicators, tab management, auto-focus behavior</li><li><strong>CodeMirror Editor</strong>: Syntax highlighting, line numbers, bracket matching, code folding, custom themes</li><li><strong>AI Chat Panel</strong>: Context-aware help, code block support with copy functionality</li><li><strong>Settings</strong>: Theme, font, tab size, word wrap, auto-save , all customizable</li><li><strong>Dashboard</strong>: Project management with search, filters, and quick actions</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ft5UZdJp6iWZH5_9DCUuaw.png" /><figcaption>Screenshot of editor layout with AI chat panel visible</figcaption></figure><h4>Architecture</h4><pre>src/<br>├── components/<br>│   ├── layout/           # Shell layout<br>│   ├── editor-page/      # Editor components<br>│   └── ui/               # Reusable primitives<br>├── lib/<br>│   ├── theme-provider.tsx<br>│   ├── settings-provider.tsx<br>│   └── project-provider.tsx<br>└── types/</pre><p>Three focused context providers handle state: <strong>ThemeProvider</strong>, <strong>SettingsProvider</strong>, <strong>ProjectProvider</strong>. Changes flow unidirectionally through IndexedDB.</p><h3>What’s Next?</h3><p><strong>Near-term</strong>: Terminal integration, git operations, more language support, find and replace</p><p><strong>Medium-term</strong>: Real AI integration, collaborative editing, extensions system, cloud sync</p><p><strong>Long-term</strong>: Debugger, build tools, deployment pipelines, mobile optimization</p><h3>Conclusion</h3><p>Code Editor X shows what’s possible when modern web technologies combine thoughtfully. The browser is no longer a limitation; it’s a feature.</p><h3>Try It Out</h3><p>Live demo , <a href="https://code-editor-x.netlify.app/">https://code-editor-x.netlify.app</a></p><p>Or run locally:</p><pre>git clone https://github.com/design-sparx/code-editor-x.git<br>cd code-editor-x<br>npm install<br>npm run dev</pre><p>Open http://localhost:5173 and start coding.</p><p><em>Built with React 19, TypeScript, CodeMirror 6, Tailwind CSS 4, and Radix UI.</em></p><p><a href="https://github.com/design-sparx/code-editor-x"><strong>GitHub</strong> </a>· <a href="https://code-editor-x.netlify.app/"><strong>Live Demo</strong></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c9b016ea3a3b" width="1" height="1" alt=""><hr><p><a href="https://blog.stackademic.com/building-a-modern-browser-based-code-editor-c9b016ea3a3b">Building a Modern Browser-Based Code Editor</a> was originally published in <a href="https://blog.stackademic.com/">Stackademic</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Design Systems from Scratch: A Practical, Code-First Guide]]></title>
            <link>https://blog.stackademic.com/design-systems-from-scratch-a-practical-code-first-guide-35ac9f4e404c?source=rss-c04ebc6450e0------2</link>
            <guid isPermaLink="false">https://medium.com/p/35ac9f4e404c</guid>
            <category><![CDATA[storybook]]></category>
            <category><![CDATA[tailwind-css]]></category>
            <category><![CDATA[radix-primitives]]></category>
            <category><![CDATA[design-systems]]></category>
            <category><![CDATA[open-source]]></category>
            <dc:creator><![CDATA[Kelvin Kiprop]]></dc:creator>
            <pubDate>Sun, 11 Jan 2026 13:52:53 GMT</pubDate>
            <atom:updated>2026-01-12T07:08:44.579Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="Prism design system home page" src="https://cdn-images-1.medium.com/max/1024/1*T4cv_eqQETl7K4NwXupyww.jpeg" /></figure><h3>TL;DR</h3><p>Design systems help teams ship consistent, accessible UIs at scale. Use off-the-shelf libraries (MUI, Ant Design, Chakra) for speed and MVPs. Build a custom system when brand, scale, or performance matter.<br>A solid design system is built on <strong>design tokens → reusable components → documentation</strong>, backed by tests and automation. Prism is an open-source design system used in this guide to show real, production-ready patterns.</p><h3>Introduction</h3><p>If you’ve worked on any modern web application, you’ve likely used a design system, whether you knew it or not. Material-UI, Ant Design, Chakra UI, and Carbon are all design systems that thousands of developers rely on daily. But what exactly is a design system, and more importantly, when should you build your own?</p><p>This guide takes you from complete beginner to confident practitioner, with real code examples from <a href="https://github.com/design-sparx/prism-designs">Prism</a>, an open-source educational design system built specifically to teach these concepts.</p><h3>What is a Design System?</h3><p>At its core, a design system is a collection of reusable components, guided by clear standards, that can be assembled to build any number of applications. Think of it as a design and development toolkit that ensures consistency across your products.</p><p>But a design system is more than just a component library. It includes:</p><ul><li><strong>Design Tokens</strong>: The atomic values (colors, spacing, typography) that define your visual language</li><li><strong>Components</strong>: Reusable UI elements built with these tokens</li><li><strong>Patterns</strong>: Common solutions to recurring design problems</li><li><strong>Documentation</strong>: Guidelines on when and how to use each element</li><li><strong>Governance</strong>: Rules and processes for maintaining consistency</li></ul><h3>Why Design Systems Matter</h3><h4>Consistency</h4><p>Without a design system, every developer makes micro-decisions about spacing, colors, and component behavior. A button in one part of your app might look completely different from a button elsewhere. Design systems eliminate this inconsistency.</p><h4>Efficiency</h4><p>Instead of rebuilding common patterns, teams can focus on solving unique business problems. Need a button? Import it. Need a modal? It’s already built and tested.</p><h4>Quality</h4><p>Design systems are typically battle-tested across multiple projects. They’ve been through accessibility audits, cross-browser testing, and real user interactions. When you use a mature design system, you inherit this quality.</p><h4>Scalability</h4><p>As your application grows, maintaining visual and functional consistency becomes exponentially harder. Design systems provide the scaffolding to scale gracefully.</p><h3>The Design System Landscape</h3><p>Before you build your own, it’s worth understanding what already exists. The design system landscape is rich and varied:</p><h3>Production Design Systems</h3><p><strong>Material-UI (MUI)</strong></p><ul><li>Google’s Material Design implemented for React</li><li>Comprehensive component library (100+ components)</li><li>Highly customizable theming system</li><li>Best for: Applications that embrace Material Design aesthetics</li></ul><p><strong>Ant Design</strong></p><ul><li>Enterprise-focused design system from Alibaba</li><li>Rich set of complex components (data tables, forms, charts)</li><li>Opinionated design language</li><li>Best for: Admin panels and enterprise applications</li></ul><p><strong>Chakra UI</strong></p><ul><li>Modern, accessible component library</li><li>Excellent developer experience with styled-system</li><li>Focuses on composition and accessibility</li><li>Best for: Quick prototyping with good accessibility</li></ul><p><strong>Radix UI / shadcn/ui</strong></p><ul><li>Unstyled, accessible component primitives (Radix)</li><li>Copy-paste component approach (shadcn/ui)</li><li>Maximum flexibility, you own the code</li><li>Best for: Teams that want full control over styling</li></ul><h3>The Problem with Off-the-Shelf Solutions</h3><p>While these design systems are excellent, they come with trade-offs:</p><ol><li><strong>Learning Curve</strong>: Each has its own API, conventions, and patterns to learn</li><li><strong>Bundle Size</strong>: You’re importing entire libraries, even if you use only a fraction</li><li><strong>Design Constraints</strong>: Your brand might not align with Material Design or Ant Design</li><li><strong>Customization Limits</strong>: Deep customization often fights against the system</li><li><strong>Dependency Risk</strong>: You’re tied to their release cycle and maintenance</li></ol><h3>When to Build Your Own Design System</h3><p>Building a design system is a significant investment. Here’s when it makes sense:</p><h4>You Have Strong Brand Requirements</h4><p>If your organization has a distinct visual identity that doesn’t align with existing design systems, building your own ensures brand consistency. A financial institution needs to convey trust and stability; a creative agency needs to showcase innovation. Off-the-shelf systems might not capture these nuances.</p><h4>You’re Building Multiple Products</h4><p>If you’re maintaining multiple applications (web app, mobile app, marketing site), a custom design system ensures consistency across all touchpoints.</p><h4>You Need Maximum Performance</h4><p>Custom design systems can be optimized for your specific use cases. You include only what you need, resulting in smaller bundle sizes and better performance.</p><h4>You Want Full Control</h4><p>When you own the design system, you control the roadmap, fix bugs on your schedule, and aren’t waiting for upstream maintainers.</p><h4>You’re Building for Education</h4><p>If you’re teaching others about design systems (like Prism does), building from scratch provides invaluable learning opportunities.</p><h3>Foundational Concepts</h3><h4>1. Design Tokens: The Foundation</h4><p>Design tokens are the atomic values that define your design language. They’re the single source of truth for colors, spacing, typography, and more.</p><p>Here’s how Prism defines color tokens:</p><pre>// packages/tokens/src/colors.ts<br>export const colors = {<br>  // Primary brand colors<br>  primary: {<br>    50: &quot;#f0f9ff&quot;,<br>    100: &quot;#e0f2fe&quot;,<br>    200: &quot;#bae6fd&quot;,<br>    300: &quot;#7dd3fc&quot;,<br>    400: &quot;#38bdf8&quot;,<br>    500: &quot;#0ea5e9&quot;,  // Base primary color<br>    600: &quot;#0284c7&quot;,<br>    700: &quot;#0369a1&quot;,<br>    800: &quot;#075985&quot;,<br>    900: &quot;#0c4a6e&quot;,<br>  },<br><br>  // Semantic colors<br>  success: {<br>    light: &quot;#10b981&quot;,<br>    main: &quot;#059669&quot;,<br>    dark: &quot;#047857&quot;,<br>  },<br><br>  error: {<br>    light: &quot;#ef4444&quot;,<br>    main: &quot;#dc2626&quot;,<br>    dark: &quot;#b91c1c&quot;,<br>  },<br>} as const;<br><br>export type ColorToken = typeof colors;</pre><p><strong>Why This Matters:</strong></p><ol><li><strong>Single Source of Truth</strong>: Change primary.500 in one place, it updates everywhere</li><li><strong>Type Safety</strong>: TypeScript knows which colors exist (try using colors.primary.1000—it won&#39;t compile)</li><li><strong>Semantic Naming</strong>: error.main is more meaningful than #dc2626</li><li><strong>Framework Agnostic</strong>: These are pure TypeScript objects, usable anywhere</li></ol><p>The same principle applies to spacing:</p><pre>// packages/tokens/src/spacing.ts<br>export const spacing = {<br>  0: &quot;0px&quot;,<br>  1: &quot;0.25rem&quot;,  // 4px<br>  2: &quot;0.5rem&quot;,   // 8px<br>  3: &quot;0.75rem&quot;,  // 12px<br>  4: &quot;1rem&quot;,     // 16px<br>  6: &quot;1.5rem&quot;,   // 24px<br>  8: &quot;2rem&quot;,     // 32px<br>  12: &quot;3rem&quot;,    // 48px<br>  16: &quot;4rem&quot;,    // 64px<br>} as const;</pre><p>This creates a consistent spacing scale. Designers and developers speak the same language: “use spacing-4 for padding” instead of debating whether padding should be 14px, 15px, or 16px.</p><h4>2. Components: Building Blocks</h4><p>Components consume design tokens and provide reusable UI elements. Let’s look at Prism’s Button component:</p><pre>// packages/react/src/components/button/button.tsx<br>import { cva, type VariantProps } from &quot;class-variance-authority&quot;;<br>import { cn } from &quot;@prism/core&quot;;<br><br>const buttonVariants = cva(<br>  // Base styles for ALL buttons<br>  [<br>    &quot;inline-flex items-center justify-center&quot;,<br>    &quot;rounded-lg font-medium&quot;,<br>    &quot;transition-colors duration-200&quot;,<br>    &quot;focus-visible:outline-none focus-visible:ring-2&quot;,<br>    &quot;disabled:pointer-events-none disabled:opacity-50&quot;,<br>  ].join(&quot; &quot;),<br>  {<br>    variants: {<br>      variant: {<br>        default: [<br>          &quot;bg-primary-500 text-white&quot;,<br>          &quot;hover:bg-primary-600&quot;,<br>        ].join(&quot; &quot;),<br>        outline: [<br>          &quot;border-2 border-neutral-300 bg-transparent&quot;,<br>          &quot;hover:bg-neutral-100&quot;,<br>        ].join(&quot; &quot;),<br>        ghost: [<br>          &quot;bg-transparent&quot;,<br>          &quot;hover:bg-neutral-100&quot;,<br>        ].join(&quot; &quot;),<br>      },<br>      size: {<br>        default: &quot;h-10 px-4 text-base&quot;,<br>        sm: &quot;h-8 px-3 text-sm&quot;,<br>        lg: &quot;h-12 px-6 text-lg&quot;,<br>      },<br>    },<br>    defaultVariants: {<br>      variant: &quot;default&quot;,<br>      size: &quot;default&quot;,<br>    },<br>  },<br>);<br><br>export interface ButtonProps<br>  extends React.ButtonHTMLAttributes&lt;HTMLButtonElement&gt;,<br>    VariantProps&lt;typeof buttonVariants&gt; {<br>  asChild?: boolean;<br>}<br><br>const Button = React.forwardRef&lt;HTMLButtonElement, ButtonProps&gt;(<br>  ({ className, variant, size, asChild = false, ...props }, ref) =&gt; {<br>    const Comp = asChild ? Slot : &quot;button&quot;;<br><br>    return (<br>      &lt;Comp<br>        className={cn(buttonVariants({ variant, size, className }))}<br>        ref={ref}<br>        {...props}<br>      /&gt;<br>    );<br>  },<br>);<br><br>Button.displayName = &quot;Button&quot;;<br><br>export { Button, buttonVariants };</pre><p><strong>Key Architectural Decisions:</strong></p><ol><li><strong>Class Variance Authority (CVA)</strong>: Manages variants in a type-safe way</li></ol><pre>// TypeScript knows these are valid:<br>   &lt;Button variant=&quot;outline&quot; size=&quot;lg&quot; /&gt;<br><br>   // TypeScript error - &quot;invalid&quot; isn&#39;t a variant:<br>   &lt;Button variant=&quot;invalid&quot; /&gt;</pre><p>2. <strong>Composition via Radix Slot</strong>: The asChild prop enables polymorphism</p><pre>{/* Renders as a link, looks like a button */}<br>   &lt;Button asChild&gt;<br>     &lt;a href=&quot;/home&quot;&gt;Go Home&lt;/a&gt;<br>   &lt;/Button&gt;</pre><p>3. <strong>Extends Native Props</strong>: Inherits all HTML button attributes</p><pre>{/* All standard button props work */}<br>&lt;Button onClick={handleClick} disabled={isLoading} type=&quot;submit&quot;&gt;<br>  Submit<br>&lt;/Button&gt;</pre><p>4. Forward Refs: Supports ref forwarding for advanced use cases</p><pre>const buttonRef = useRef&lt;HTMLButtonElement&gt;(null);<br>   &lt;Button ref={buttonRef}&gt;Focus me&lt;/Button&gt;</pre><h3>3. Architecture Patterns</h3><h4>Monorepo Structure</h4><p>Prism uses a monorepo to manage multiple related packages:</p><pre>prism/<br>├── packages/<br>│   ├── tokens/      # Design tokens (no dependencies)<br>│   ├── core/        # Utilities (depends on tokens)<br>│   └── react/       # Components (depends on core &amp; tokens)<br>└── apps/<br>    └── docs/        # Storybook (depends on react)</pre><p>This structure enforces a clear dependency hierarchy:</p><ul><li>Tokens are the foundation (no dependencies)</li><li>Core adds utilities on top of tokens</li><li>Components consume both tokens and core</li><li>Documentation uses the components</li></ul><h4>Build Pipeline with Turborepo</h4><p>Turborepo orchestrates builds intelligently:</p><pre>// turbo.json<br>{<br>  &quot;tasks&quot;: {<br>    &quot;build&quot;: {<br>      &quot;dependsOn&quot;: [&quot;^build&quot;],  // Build dependencies first<br>      &quot;outputs&quot;: [&quot;dist/**&quot;]<br>    }<br>  }<br>}</pre><p>When you run pnpm build, Turborepo:</p><ol><li>Builds @prism/tokens first</li><li>Then builds @prism/core (needs tokens)</li><li>Then builds @prism/react (needs both)</li><li>Finally builds documentation (needs react)</li></ol><p>Unchanged packages are skipped (cached), making rebuilds lightning-fast.</p><h3>Practical Example: Building a Card Component</h3><p>Let’s walk through creating a Card component from scratch, applying everything we’ve learned.</p><h4>Step 1: Define the Component Structure</h4><pre>// packages/react/src/components/card/card.tsx<br>import * as React from &quot;react&quot;;<br>import { cva, type VariantProps } from &quot;class-variance-authority&quot;;<br>import { cn } from &quot;@prism/core&quot;;<br><br>const cardVariants = cva(<br>  [<br>    &quot;rounded-lg&quot;,<br>    &quot;transition-shadow duration-200&quot;,<br>  ].join(&quot; &quot;),<br>  {<br>    variants: {<br>      variant: {<br>        elevated: &quot;bg-white shadow-md hover:shadow-lg&quot;,<br>        outlined: &quot;bg-white border-2 border-neutral-200&quot;,<br>        filled: &quot;bg-neutral-100&quot;,<br>      },<br>      padding: {<br>        none: &quot;p-0&quot;,<br>        sm: &quot;p-3&quot;,<br>        md: &quot;p-4&quot;,<br>        lg: &quot;p-6&quot;,<br>      },<br>    },<br>    defaultVariants: {<br>      variant: &quot;elevated&quot;,<br>      padding: &quot;md&quot;,<br>    },<br>  },<br>);<br><br>export interface CardProps<br>  extends React.HTMLAttributes&lt;HTMLDivElement&gt;,<br>    VariantProps&lt;typeof cardVariants&gt; {}<br><br>const Card = React.forwardRef&lt;HTMLDivElement, CardProps&gt;(<br>  ({ className, variant, padding, ...props }, ref) =&gt; {<br>    return (<br>      &lt;div<br>        ref={ref}<br>        className={cn(cardVariants({ variant, padding, className }))}<br>        {...props}<br>      /&gt;<br>    );<br>  },<br>);<br><br>Card.displayName = &quot;Card&quot;;<br><br>export { Card, cardVariants };</pre><h4>Step 2: Create Compound Components</h4><p>Cards often have sections (header, body, footer). Use compound components:</p><pre>const CardHeader = React.forwardRef&lt;<br>  HTMLDivElement,<br>  React.HTMLAttributes&lt;HTMLDivElement&gt;<br>&gt;(({ className, ...props }, ref) =&gt; (<br>  &lt;div<br>    ref={ref}<br>    className={cn(&quot;flex flex-col space-y-1.5&quot;, className)}<br>    {...props}<br>  /&gt;<br>));<br>CardHeader.displayName = &quot;CardHeader&quot;;<br><br>const CardTitle = React.forwardRef&lt;<br>  HTMLHeadingElement,<br>  React.HTMLAttributes&lt;HTMLHeadingElement&gt;<br>&gt;(({ className, ...props }, ref) =&gt; (<br>  &lt;h3<br>    ref={ref}<br>    className={cn(&quot;text-lg font-semibold leading-none&quot;, className)}<br>    {...props}<br>  /&gt;<br>));<br>CardTitle.displayName = &quot;CardTitle&quot;;<br><br>const CardContent = React.forwardRef&lt;<br>  HTMLDivElement,<br>  React.HTMLAttributes&lt;HTMLDivElement&gt;<br>&gt;(({ className, ...props }, ref) =&gt; (<br>  &lt;div ref={ref} className={cn(&quot;pt-0&quot;, className)} {...props} /&gt;<br>));<br>CardContent.displayName = &quot;CardContent&quot;;</pre><h4>Step 3: Usage</h4><pre>import { Card, CardHeader, CardTitle, CardContent } from &quot;@prism/react/card&quot;;<br><br>function ProductCard() {<br>  return (<br>    &lt;Card variant=&quot;elevated&quot;&gt;<br>      &lt;CardHeader&gt;<br>        &lt;CardTitle&gt;Premium Plan&lt;/CardTitle&gt;<br>      &lt;/CardHeader&gt;<br>      &lt;CardContent&gt;<br>        &lt;p&gt;Unlock all features for $29/month&lt;/p&gt;<br>      &lt;/CardContent&gt;<br>    &lt;/Card&gt;<br>  );<br>}</pre><p>This pattern provides:</p><ul><li><strong>Flexibility</strong>: Compose cards however you need</li><li><strong>Consistency</strong>: All cards follow the same structure</li><li><strong>Type Safety</strong>: TypeScript guides you through usage</li></ul><h4>Step 4: Write Tests</h4><p>Testing is non-negotiable in design systems:</p><pre>// packages/react/src/components/card/card.spec.tsx<br>import { render, screen } from &quot;@testing-library/react&quot;;<br>import { Card, CardHeader, CardTitle, CardContent } from &quot;./card&quot;;<br><br>describe(&quot;Card&quot;, () =&gt; {<br>  it(&quot;renders children correctly&quot;, () =&gt; {<br>    render(&lt;Card&gt;Test content&lt;/Card&gt;);<br>    expect(screen.getByText(&quot;Test content&quot;)).toBeInTheDocument();<br>  });<br><br>  it(&quot;applies variant classes&quot;, () =&gt; {<br>    const { container } = render(&lt;Card variant=&quot;outlined&quot;&gt;Content&lt;/Card&gt;);<br>    const card = container.firstChild as HTMLElement;<br>    expect(card).toHaveClass(&quot;border-2&quot;);<br>  });<br><br>  it(&quot;supports compound components&quot;, () =&gt; {<br>    render(<br>      &lt;Card&gt;<br>        &lt;CardHeader&gt;<br>          &lt;CardTitle&gt;Title&lt;/CardTitle&gt;<br>        &lt;/CardHeader&gt;<br>        &lt;CardContent&gt;Body&lt;/CardContent&gt;<br>      &lt;/Card&gt;<br>    );<br><br>    expect(screen.getByText(&quot;Title&quot;)).toBeInTheDocument();<br>    expect(screen.getByText(&quot;Body&quot;)).toBeInTheDocument();<br>  });<br>});</pre><p>Prism requires 80% test coverage, ensuring components are reliable.</p><h3>Documentation with Storybook</h3><p>Great components need great documentation. Prism uses Storybook with CSF3 (Component Story Format 3):</p><pre>// apps/docs/stories/button.stories.tsx<br>import type { Meta, StoryObj } from &quot;@storybook/react&quot;;<br>import { Button } from &quot;@prism/react/button&quot;;<br><br>const meta = {<br>  title: &quot;Components/Button&quot;,<br>  component: Button,<br>  parameters: {<br>    layout: &quot;centered&quot;,<br>  },<br>  tags: [&quot;autodocs&quot;],<br>} satisfies Meta&lt;typeof Button&gt;;<br><br>export default meta;<br>type Story = StoryObj&lt;typeof meta&gt;;<br><br>export const Default: Story = {<br>  args: {<br>    children: &quot;Click me&quot;,<br>  },<br>};<br><br>export const Variants: Story = {<br>  render: () =&gt; (<br>    &lt;div className=&quot;flex gap-2&quot;&gt;<br>      &lt;Button variant=&quot;default&quot;&gt;Default&lt;/Button&gt;<br>      &lt;Button variant=&quot;outline&quot;&gt;Outline&lt;/Button&gt;<br>      &lt;Button variant=&quot;ghost&quot;&gt;Ghost&lt;/Button&gt;<br>    &lt;/div&gt;<br>  ),<br>};<br><br>export const Sizes: Story = {<br>  render: () =&gt; (<br>    &lt;div className=&quot;flex items-center gap-2&quot;&gt;<br>      &lt;Button size=&quot;sm&quot;&gt;Small&lt;/Button&gt;<br>      &lt;Button size=&quot;default&quot;&gt;Default&lt;/Button&gt;<br>      &lt;Button size=&quot;lg&quot;&gt;Large&lt;/Button&gt;<br>    &lt;/div&gt;<br>  ),<br>};</pre><p>This generates interactive documentation where users can:</p><ul><li>See all variants visually</li><li>Adjust props in real-time</li><li>View component source code</li><li>Copy usage examples</li></ul><h3>Getting Started with Your Own Design System</h3><p>Ready to build your own? Here’s a roadmap:</p><h4>Phase 1: Foundation (Week 1–2)</h4><ol><li><strong>Set up monorepo: Use Turborepo or Nx</strong></li><li><strong>Create tokens package</strong>: Define colors, spacing, typography</li><li><strong>Set up build pipeline</strong>: Configure tsup for bundling</li><li><strong>Initialize documentation</strong>: Set up Storybook</li></ol><h4>Phase 2: Core Components (Week 3–6)</h4><ol><li><strong>Build foundational components</strong>: Button, Input, Text</li><li><strong>Establish patterns</strong>: CVA for variants, Radix for primitives</li><li><strong>Write tests</strong>: Aim for 80% coverage</li><li><strong>Document in Storybook</strong>: Show all variants and use cases</li></ol><h4>Phase 3: Advanced Components (Week 7–10)</h4><ol><li><strong>Build complex components</strong>: Modal, Dropdown, DataTable</li><li><strong>Add composition patterns</strong>: Compound components</li><li><strong>Implement theming</strong>: Light/dark mode support</li><li><strong>Accessibility audit</strong>: Keyboard nav, screen readers, ARIA</li></ol><h4>Phase 4: Polish &amp; Release (Week 11–12)</h4><ol><li><strong>Performance optimization</strong>: Bundle size, tree-shaking</li><li><strong>API refinement</strong>: Consistent prop naming, logical defaults</li><li><strong>Migration guides</strong>: Help users upgrade</li><li><strong>Publish to npm</strong>: Make it available to your team</li></ol><h3>Key Takeaways</h3><ol><li><strong>Start with Tokens</strong>: They’re the foundation of consistency</li><li><strong>Invest in Architecture</strong>: Auto-discovery and build pipelines pay dividends</li><li><strong>Test Thoroughly</strong>: Design systems must be reliable</li><li><strong>Document Everything</strong>: If it’s not documented, it doesn’t exist</li><li><strong>Keep It Simple</strong>: Over-engineering kills design systems</li><li><strong>Make It Accessible</strong>: This isn’t optional</li><li><strong>Own Your Code</strong>: Building your own gives you control</li></ol><h3>When to Use Off-the-Shelf vs. Custom</h3><p><strong>Use Off-the-Shelf (Material-UI, Ant Design) When:</strong></p><ul><li>You’re building an MVP or prototype</li><li>Your team is small, and velocity matters</li><li>The visual design aligns with your brand</li><li>You don’t have design system expertise in-house</li></ul><p><strong>Build Custom (Like Prism) When:</strong></p><ul><li>You have strong brand requirements</li><li>You’re building multiple products</li><li>You need maximum performance</li><li>You want full control over the roadmap</li><li>You’re building for education or learning</li></ul><h3>Learning Resources</h3><ul><li><strong>Prism Source Code</strong>: <a href="https://github.com/design-sparx/prism-designs">https://github.com/design-sparx/prism-designs</a></li><li><strong>Brad Frost’s Atomic Design</strong>: Foundational design system methodology</li><li><strong>Design Tokens Specification</strong>: W3C community group standard</li><li><strong>Radix UI</strong>: Learn accessibility patterns from the best</li><li><strong>Storybook Documentation</strong>: Master component documentation</li></ul><h3>Conclusion</h3><p>Design systems are challenging but rewarding. They require upfront investment but pay dividends in consistency, quality, and velocity. Whether you choose an off-the-shelf solution or build your own, understanding the underlying principles makes you a better developer.</p><p>Prism exists to make this learning curve gentler. Every decision is documented, every pattern is explained, and the entire codebase is designed for education. Clone it, explore it, break it, rebuild it — that’s how you’ll truly understand design systems.</p><p>Now go build something amazing.</p><p><strong>Want to contribute or learn more?</strong> Check out <a href="https://github.com/design-sparx/prism-designs">Prism on GitHub</a> and join the conversation. Design systems are better when we build them together.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=35ac9f4e404c" width="1" height="1" alt=""><hr><p><a href="https://blog.stackademic.com/design-systems-from-scratch-a-practical-code-first-guide-35ac9f4e404c">Design Systems from Scratch: A Practical, Code-First Guide</a> was originally published in <a href="https://blog.stackademic.com/">Stackademic</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building a Modern Data Grid: Combining TanStack Table with Fluent UI React]]></title>
            <link>https://blog.stackademic.com/building-a-modern-data-grid-combining-tanstack-table-with-fluent-ui-react-bb86748308bc?source=rss-c04ebc6450e0------2</link>
            <guid isPermaLink="false">https://medium.com/p/bb86748308bc</guid>
            <category><![CDATA[datatables]]></category>
            <category><![CDATA[tanstack-table]]></category>
            <category><![CDATA[datagrid]]></category>
            <category><![CDATA[fluent-ui]]></category>
            <dc:creator><![CDATA[Kelvin Kiprop]]></dc:creator>
            <pubDate>Sun, 03 Nov 2024 17:15:43 GMT</pubDate>
            <atom:updated>2024-11-04T06:21:02.676Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ll0cudPSvpkQdTVLzcxMDg.png" /><figcaption>A showcase image of the data grid</figcaption></figure><h3>TL;DR</h3><p>Built a feature-rich data grid combining TanStack Table with Fluent UI React that includes:</p><ul><li>🔍 Real-time search with optimized performance using useMemo</li><li>📊 Customizable pagination with page size selection</li><li>👤 User avatar integration with email display</li><li>⌨️ Full keyboard navigation and accessibility support</li><li>🎨 Fluent UI design system styling</li><li>🚀 Performance optimized with React.memo and useCallback</li><li>📱 Responsive action buttons and menu dropdowns</li></ul><p><a href="https://fluentui-tanstack-datagrid.vercel.app/">View Demo</a> | <a href="https://github.com/kelvink96/fluentui-tanstack-datagrid">Source Code</a></p><p>As a developer working with Microsoft’s Fluent UI React framework, I encountered a common challenge. While Fluent UI provides beautiful and consistent components, its table implementations lack built-in features like pagination and filtering that come standard in other UI frameworks. In this blog post, I’ll show you how I solved this by integrating TanStack Table (formerly React Table) with Fluent UI to create a feature-rich data grid solution.</p><h3>The Challenge</h3><p>Fluent UI’s Table and DataGrid components are great for basic use cases, but they don&#39;t provide out-of-the-box features that you might find in Material-UI, Ant Design, or Mantine data grids, such as:</p><ul><li>Pagination</li><li>Global and column filtering</li><li>Column resizing</li><li>Column reordering</li></ul><h3>Enter TanStack Table</h3><p>TanStack Table is a headless UI library that provides all the functionality we need without imposing any styling constraints. This makes it perfect for integration with Fluent UI’s design system.</p><h3>Implementation</h3><p>Let’s walk through the key components and features.</p><h4>1. Project Setup</h4><p>First, install the required dependencies:</p><pre>npm install @fluentui/react-components @fluentui/react-icons @tanstack/react-table moment</pre><h4>2. Table Component Structure</h4><p>The table implementation is split into several key parts:</p><pre>export type TableProps&lt;TData, TValue&gt; = Partial&lt;FluentTableProps&gt; &amp; {<br>    data: TData[];<br>    columns: ColumnDef&lt;TData, TValue&gt;[];<br>    filters?: boolean;<br>    showPagination?: boolean;<br>    showPageCount?: boolean;<br>    showPageLength?: boolean;<br>    showPageSelector?: boolean;<br>    pageCount?: number;<br>    loading?: boolean<br>};</pre><h4>3. Search Implementation</h4><p>The search functionality is implemented using React’s useMemo for performance:</p><pre>function App() {<br>    const [searchQuery, setSearchQuery] = useState(&#39;&#39;);<br><br>    const filteredData = useMemo(() =&gt; {<br>        return sampleUsers.filter(user =&gt; {<br>            const searchTerm = searchQuery.toLowerCase();<br>            const userName = user.User.Title.toLowerCase();<br>            const userEmail = user.User.EMail.toLowerCase();<br><br>            return userName.includes(searchTerm) || userEmail.includes(searchTerm);<br>        });<br>    }, [searchQuery]);<br><br>    return (<br>        &lt;FluentProvider theme={webLightTheme}&gt;<br>            &lt;Card&gt;<br>                &lt;CardHeader<br>                    header={&lt;Title3&gt;Fluentui x Tanstack DataGrid&lt;/Title3&gt;}<br>                    action={&lt;SearchBox<br>                        placeholder=&quot;Search users...&quot;<br>                        value={searchQuery}<br>                        onChange={(_e, data) =&gt; setSearchQuery(data.value)}<br>                    /&gt;}<br>                /&gt;<br>                &lt;Table data={filteredData} columns={columns} showPagination showPageCount/&gt;<br>            &lt;/Card&gt;<br>        &lt;/FluentProvider&gt;<br>    );<br>}</pre><h4>4. Column Definitions</h4><p>The columns are defined with custom cell renderers for different data types:</p><pre>const columns: ColumnDef&lt;UserData&gt;[] = [<br>    {<br>        accessorKey: &#39;&#39;,<br>        header: &#39;User&#39;,<br>        cell: ({row}) =&gt; (<br>            &lt;UserAvatar<br>                name={row.original?.User?.Title ?? &#39;undefined&#39;}<br>                email={row.original?.User?.EMail}<br>            /&gt;<br>        )<br>    },<br>    {<br>        accessorKey: &#39;&#39;,<br>        header: &#39;User&#39;,<br>        cell: ({row}) =&gt; (<br>            &lt;Text className=&quot;text-lowercase&quot;&gt;<br>                {row.original?.User?.EMail}<br>            &lt;/Text&gt;<br>        )<br>    },<br>    {<br>        accessorKey: &#39;Modified&#39;,<br>        header: &#39;Modified&#39;,<br>        cell: ({row}) =&gt; (<br>            &lt;Text&gt;{dateFormatter(row.original?.Modified ?? &#39;&#39;)}&lt;/Text&gt;<br>        )<br>    },<br>    {<br>        header: &#39;Actions&#39;,<br>        cell: ({row}) =&gt; (<br>            &lt;Flex&gt;<br>                &lt;Button<br>                    icon={&lt;EditIcon color={tokens.colorPaletteBlueForeground2}/&gt;}<br>                    onClick={() =&gt; {<br>                        alert(row.original.Id);<br>                    }}<br>                &gt;<br>                    View<br>                &lt;/Button&gt;<br>                &lt;Button<br>                    icon={&lt;DeleteIcon color={tokens.colorPaletteRedForeground1}/&gt;}<br>                    onClick={() =&gt; {<br>                        alert(row.original.Id);<br>                    }}<br>                &gt;<br>                    Delete<br>                &lt;/Button&gt;<br>                &lt;Menu&gt;<br>                    &lt;MenuTrigger disableButtonEnhancement&gt;<br>                        &lt;Button icon={&lt;MenuIcon/&gt;}/&gt;<br>                    &lt;/MenuTrigger&gt;<br>                    &lt;MenuPopover&gt;<br>                        &lt;MenuList&gt;<br>                            &lt;MenuItem&gt;New &lt;/MenuItem&gt;<br>                            &lt;MenuItem&gt;New Window&lt;/MenuItem&gt;<br>                            &lt;MenuItem disabled&gt;Open File&lt;/MenuItem&gt;<br>                            &lt;MenuItem&gt;Open Folder&lt;/MenuItem&gt;<br>                        &lt;/MenuList&gt;<br>                    &lt;/MenuPopover&gt;<br>                &lt;/Menu&gt;<br>            &lt;/Flex&gt;<br>        )<br>    }<br>];</pre><h4>5. Performance Optimizations</h4><p>Several performance optimizations are implemented:</p><pre>// Memoized TableRow component<br>const MemoizedTableRow = memo(<br>    ({row, onClick, index}: { row: any; onClick?: (row: any) =&gt; void; index: number }) =&gt; {<br>        const styles = useStyles();<br>        const handleKeyDown = useCallback((e: React.KeyboardEvent) =&gt; {<br>            if (e.key === &#39;Enter&#39; || e.key === &#39; &#39;) {<br>                e.preventDefault();<br>                onClick?.(row);<br>            }<br>        }, [onClick, row]);<br><br>        return (<br>            &lt;TableRow<br>                key={row.id}<br>                style={{borderBottom: &#39;none&#39;, marginBottom: &#39;10px&#39;}}<br>                onClick={() =&gt; onClick?.(row)}<br>                onKeyDown={handleKeyDown}<br>                tabIndex={0}<br>                role=&quot;row&quot;<br>                aria-rowindex={index + 1}<br>                className={styles.focusVisible}<br>            &gt;<br>                {/* Row content */}<br>            &lt;/TableRow&gt;<br>        );<br>    },<br>    (prevProps, nextProps) =&gt; {<br>        return prevProps.row.id === nextProps.row.id &amp;&amp;<br>            JSON.stringify(prevProps.row.original) === JSON.stringify(nextProps.row.original);<br>    }<br>);</pre><h4>6. Accessibility Features</h4><p>The table includes several accessibility enhancements:</p><pre>// Keyboard navigation<br>const handleTableKeyDown = useCallback((e: React.KeyboardEvent) =&gt; {<br>    const focusableElements = document.querySelectorAll(&#39;tr[tabindex=&quot;0&quot;]&#39;);<br>    const currentIndex = Array.from(focusableElements).indexOf(document.activeElement as HTMLElement);<br><br>    switch (e.key) {<br>        case &#39;ArrowDown&#39;:<br>            e.preventDefault();<br>            if (currentIndex &lt; focusableElements.length - 1) {<br>                (focusableElements[currentIndex + 1] as HTMLElement).focus();<br>            }<br>            break;<br>        // ... other keyboard handlers<br>    }<br>}, []);</pre><h4>7. Styling and Theme Integration</h4><p>The table uses Fluent UI’s styling system:</p><pre>const useStyles = makeStyles({<br>    focusVisible: {<br>        &#39;&amp;:focus-visible&#39;: {<br>            outline: &#39;2px solid var(--colorBrandForeground1)&#39;,<br>            outlineOffset: &#39;2px&#39;<br>        }<br>    }<br>});</pre><h3>Best Practices and Tips</h3><ol><li><strong>Performance</strong></li></ol><ul><li>Use memoization for rows and computation-heavy operations</li><li>Implement proper comparison functions for memoized components</li><li>Use virtualization for large datasets</li></ul><p><strong>2. Accessibility</strong></p><ul><li>Include proper ARIA attributes</li><li>Implement keyboard navigation</li><li>Provide clear focus indicators</li><li>Use semantic HTML</li></ul><p><strong>3. State Management</strong></p><ul><li>Keep the search state at the app level</li><li>Memoize filtered results</li><li>Handle loading states appropriately</li></ul><p><strong>4. Code Organization</strong></p><ul><li>Separate concerns (UI components, data handling, utilities)</li><li>Use TypeScript for better type safety</li><li>Follow consistent naming conventions</li></ul><h3>Conclusion</h3><p>By combining TanStack Table with Fluent UI, we’ve created a powerful, accessible, and performant data grid solution that provides:</p><ul><li>Real-time search functionality</li><li>Accessible navigation and interaction</li><li>Performance optimizations</li><li>Consistent Fluent UI styling</li><li>Type-safe implementation</li><li>Flexible column definitions</li><li>Custom cell renderers</li></ul><p>The complete source code for this implementation is available on my GitHub: <a href="https://github.com/kelvink96/fluentui-tanstack-datagrid">fluentui-tanstack-grid-repo</a></p><p>Happy coding! 💖</p><h3>Stackademic 🎓</h3><p>Thank you for reading until the end. Before you go:</p><ul><li>Please consider <strong>clapping</strong> and <strong>following</strong> the writer! 👏</li><li>Follow us <a href="https://twitter.com/stackademichq"><strong>X</strong></a> | <a href="https://www.linkedin.com/company/stackademic"><strong>LinkedIn</strong></a> | <a href="https://www.youtube.com/c/stackademic"><strong>YouTube</strong></a> | <a href="https://discord.gg/in-plain-english-709094664682340443"><strong>Discord</strong></a> | <a href="https://newsletter.plainenglish.io/"><strong>Newsletter</strong></a> | <a href="https://open.spotify.com/show/7qxylRWKhvZwMz2WuEoua0"><strong>Podcast</strong></a></li><li><a href="https://differ.blog/"><strong>Create a free AI-powered blog on Differ.</strong></a></li><li>More content at <a href="https://stackademic.com/"><strong>Stackademic.com</strong></a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bb86748308bc" width="1" height="1" alt=""><hr><p><a href="https://blog.stackademic.com/building-a-modern-data-grid-combining-tanstack-table-with-fluent-ui-react-bb86748308bc">Building a Modern Data Grid: Combining TanStack Table with Fluent UI React</a> was originally published in <a href="https://blog.stackademic.com/">Stackademic</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to build your design system with Radix Primitives and Facebook’s StyleX]]></title>
            <link>https://blog.stackademic.com/how-to-build-your-design-system-with-radix-primitives-and-facebooks-stylex-e8de5ebe5278?source=rss-c04ebc6450e0------2</link>
            <guid isPermaLink="false">https://medium.com/p/e8de5ebe5278</guid>
            <category><![CDATA[open-source]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[stylex]]></category>
            <category><![CDATA[vites]]></category>
            <category><![CDATA[radix]]></category>
            <dc:creator><![CDATA[Kelvin Kiprop]]></dc:creator>
            <pubDate>Fri, 05 Jan 2024 13:46:25 GMT</pubDate>
            <atom:updated>2024-01-08T00:55:08.823Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4Z1NzZFICR-9CQ8fq2_BXA.jpeg" /><figcaption>Photo of Budget Buddy Landing Page</figcaption></figure><p>In this article, discover the dynamic synergy between Radix Primitives and StyleX, uncovering how their collaboration forms the backbone of an exceptional design system.</p><blockquote><strong>TL;DR</strong>: This project is open-source on GitHub. Feel free to explore and fork it for your own use. To check it out use this link — <a href="https://github.com/design-sparx/budget-buddy">https://github.com/design-sparx/budget-buddy</a>.</blockquote><h3>Understanding Design Systems</h3><p>A design system is a collection of reusable components and clear standards that can be assembled to build any number of applications. Design systems aid in digital product design and development of products such as mobile applications or websites.</p><p>A design system is a set of patterns and practices that help teams across an organization — from designers to developers — create consistent, accessible digital products. There are different models, but most consist of a pattern library, design tokens, brand and style guidelines, and documentation on how to use the system.</p><h4>Advantages of Design Systems</h4><ul><li>A Streamlined Design-to-production Workflow</li><li>Less Redundancy</li><li>A Shared Language from Code to Customer</li><li>Design Systems Foster Higher Quality Products and Better User Experience</li><li>A Familiar and Intuitive UI</li><li>Promoting the company’s design philosophy and principles.</li><li>Closing the brand-product gap.</li></ul><h3>Introduction to Radix Primitives</h3><p>Radix Primitives is an open-source UI component library for building high-quality, accessible design systems and web apps.</p><p>It comprises a collection of low-level UI component libraries with a focus on accessibility, customization, and developer experience.</p><h4>Key features of Radix Primitives</h4><ul><li>Accessible</li><li>Unstyled</li><li>Opened</li><li>Uncontrolled</li></ul><h3>Implementing Radix Primitives</h3><p>Radix Primitives offers incremental adoption of the different components hence each component can be installed individually so you can adopt them incrementally.</p><pre>npm install @radix-ui/react-dialog<br>npm install @radix-ui/react-dropdown-menu<br>npm install @radix-ui/react-tooltip</pre><h4>Examples of Radix primitives</h4><ol><li>Dialog</li></ol><pre>import React from &#39;react&#39;;<br>import * as AlertDialog from &#39;@radix-ui/react-alert-dialog&#39;;<br>import &#39;./styles.css&#39;;<br><br>const AlertDialogDemo = () =&gt; (<br>  &lt;AlertDialog.Root&gt;<br>    &lt;AlertDialog.Trigger asChild&gt;<br>      &lt;button className=&quot;Button violet&quot;&gt;Delete account&lt;/button&gt;<br>    &lt;/AlertDialog.Trigger&gt;<br>    &lt;AlertDialog.Portal&gt;<br>      &lt;AlertDialog.Overlay className=&quot;AlertDialogOverlay&quot; /&gt;<br>      &lt;AlertDialog.Content className=&quot;AlertDialogContent&quot;&gt;<br>        &lt;AlertDialog.Title className=&quot;AlertDialogTitle&quot;&gt;Are you absolutely sure?&lt;/AlertDialog.Title&gt;<br>        &lt;AlertDialog.Description className=&quot;AlertDialogDescription&quot;&gt;<br>          This action cannot be undone. This will permanently delete your account and remove your<br>          data from our servers.<br>        &lt;/AlertDialog.Description&gt;<br>        &lt;div style={{ display: &#39;flex&#39;, gap: 25, justifyContent: &#39;flex-end&#39; }}&gt;<br>          &lt;AlertDialog.Cancel asChild&gt;<br>            &lt;button className=&quot;Button mauve&quot;&gt;Cancel&lt;/button&gt;<br>          &lt;/AlertDialog.Cancel&gt;<br>          &lt;AlertDialog.Action asChild&gt;<br>            &lt;button className=&quot;Button red&quot;&gt;Yes, delete account&lt;/button&gt;<br>          &lt;/AlertDialog.Action&gt;<br>        &lt;/div&gt;<br>      &lt;/AlertDialog.Content&gt;<br>    &lt;/AlertDialog.Portal&gt;<br>  &lt;/AlertDialog.Root&gt;<br>);<br><br>export default AlertDialogDemo;</pre><p>2. Tooltip</p><pre>import React from &#39;react&#39;;<br>import * as Tooltip from &#39;@radix-ui/react-tooltip&#39;;<br>import { PlusIcon } from &#39;@radix-ui/react-icons&#39;;<br>import &#39;./styles.css&#39;;<br><br>const TooltipDemo = () =&gt; {<br>  return (<br>    &lt;Tooltip.Provider&gt;<br>      &lt;Tooltip.Root&gt;<br>        &lt;Tooltip.Trigger asChild&gt;<br>          &lt;button className=&quot;IconButton&quot;&gt;<br>            &lt;PlusIcon /&gt;<br>          &lt;/button&gt;<br>        &lt;/Tooltip.Trigger&gt;<br>        &lt;Tooltip.Portal&gt;<br>          &lt;Tooltip.Content className=&quot;TooltipContent&quot; sideOffset={5}&gt;<br>            Add to library<br>            &lt;Tooltip.Arrow className=&quot;TooltipArrow&quot; /&gt;<br>          &lt;/Tooltip.Content&gt;<br>        &lt;/Tooltip.Portal&gt;<br>      &lt;/Tooltip.Root&gt;<br>    &lt;/Tooltip.Provider&gt;<br>  );<br>};<br><br>export default TooltipDemo;</pre><p>3. Collapsible</p><pre>import React from &#39;react&#39;;<br>import * as Collapsible from &#39;@radix-ui/react-collapsible&#39;;<br>import { RowSpacingIcon, Cross2Icon } from &#39;@radix-ui/react-icons&#39;;<br>import &#39;./styles.css&#39;;<br><br>const CollapsibleDemo = () =&gt; {<br>  const [open, setOpen] = React.useState(false);<br>  return (<br>    &lt;Collapsible.Root className=&quot;CollapsibleRoot&quot; open={open} onOpenChange={setOpen}&gt;<br>      &lt;div style={{ display: &#39;flex&#39;, alignItems: &#39;center&#39;, justifyContent: &#39;space-between&#39; }}&gt;<br>        &lt;span className=&quot;Text&quot; style={{ color: &#39;white&#39; }}&gt;<br>          @peduarte starred 3 repositories<br>        &lt;/span&gt;<br>        &lt;Collapsible.Trigger asChild&gt;<br>          &lt;button className=&quot;IconButton&quot;&gt;{open ? &lt;Cross2Icon /&gt; : &lt;RowSpacingIcon /&gt;}&lt;/button&gt;<br>        &lt;/Collapsible.Trigger&gt;<br>      &lt;/div&gt;<br><br>      &lt;div className=&quot;Repository&quot;&gt;<br>        &lt;span className=&quot;Text&quot;&gt;@radix-ui/primitives&lt;/span&gt;<br>      &lt;/div&gt;<br><br>      &lt;Collapsible.Content&gt;<br>        &lt;div className=&quot;Repository&quot;&gt;<br>          &lt;span className=&quot;Text&quot;&gt;@radix-ui/colors&lt;/span&gt;<br>        &lt;/div&gt;<br>        &lt;div className=&quot;Repository&quot;&gt;<br>          &lt;span className=&quot;Text&quot;&gt;@stitches/react&lt;/span&gt;<br>        &lt;/div&gt;<br>      &lt;/Collapsible.Content&gt;<br>    &lt;/Collapsible.Root&gt;<br>  );<br>};<br><br>export default CollapsibleDemo;</pre><h4>Customizing Radix Primitives</h4><ol><li>Custom Dialog</li></ol><pre>export default () =&gt; {<br>  const [container, setContainer] = React.useState(null);<br>  return (<br>    &lt;div&gt;<br>      &lt;AlertDialog.Root&gt;<br>        &lt;AlertDialog.Trigger /&gt;<br>        &lt;AlertDialog.Portal container={container}&gt;<br>          &lt;AlertDialog.Overlay /&gt;<br>          &lt;AlertDialog.Content&gt;...&lt;/AlertDialog.Content&gt;<br>        &lt;/AlertDialog.Portal&gt;<br>      &lt;/AlertDialog.Root&gt;<br><br>      &lt;div ref={setContainer} /&gt;<br>    &lt;/div&gt;<br>  );<br>};</pre><p>2. Configure tooltip globally</p><pre>import * as Tooltip from &#39;@radix-ui/react-tooltip&#39;;<br><br>export default () =&gt; (<br>  &lt;Tooltip.Provider delayDuration={800} skipDelayDuration={500}&gt;<br>    &lt;Tooltip.Root&gt;<br>      &lt;Tooltip.Trigger&gt;…&lt;/Tooltip.Trigger&gt;<br>      &lt;Tooltip.Content&gt;…&lt;/Tooltip.Content&gt;<br>    &lt;/Tooltip.Root&gt;<br>    &lt;Tooltip.Root&gt;<br>      &lt;Tooltip.Trigger&gt;…&lt;/Tooltip.Trigger&gt;<br>      &lt;Tooltip.Content&gt;…&lt;/Tooltip.Content&gt;<br>    &lt;/Tooltip.Root&gt;<br>  &lt;/Tooltip.Provider&gt;<br>);</pre><h3>Understanding Facebook’s StyleX</h3><p>StyleX is a simple, easy-to-use JavaScript syntax and compiler for styling web apps. It combines the strengths and avoids the weaknesses of both inline styles and static CSS. Defining and using styles requires only local knowledge within a component and avoids specificity issues while retaining features like Media Queries.</p><h4><strong>Features of StyleX</strong></h4><ul><li>Scalable</li><li>Predictable</li><li>Composable</li><li>Fast</li><li>Type-Safe</li></ul><p>How StyleX enhances the development of design systems through encapsulated styling and theme management.</p><pre>// Define styles<br><br>import * as stylex from &#39;@stylexjs/stylex&#39;;<br><br>const styles = stylex.create({<br>  root: {<br>    width: &#39;100%&#39;,<br>    maxWidth: 800,<br>    minHeight: 40,<br>  },<br>});</pre><pre>// Use styles<br><br>import * as React from &#39;react&#39;;<br>import * as stylex from &#39;@stylexjs/stylex&#39;;<br><br>const styles = stylex.create({ ... });<br>const colorStyles = stylex.create({ ... });<br><br>function ReactDiv({ color, isActive, style }) {<br>  return &lt;div {...stylex.props(<br>    styles.main,<br>    // apply styles conditionally<br>    isActive &amp;&amp; styles.active,<br>    // choose a style variant based on a prop<br>    colorStyles[color],<br>    // styles passed as props<br>    style,<br>  )} /&gt;;<br>}</pre><h3>Integrating StyleX into the Design System</h3><p>Here are examples of components styled using StyleX.</p><ol><li>Buttons</li></ol><pre>//Button.tsx<br><br>import { ComponentProps, ReactNode } from &#39;react&#39;;<br>import * as stylex from &#39;@stylexjs/stylex&#39;;<br>import { styles } from &#39;./Button.styles.ts&#39;;<br>import { ButtonVariants, ISizes } from &#39;../../../types&#39;;<br><br>export type ButtonProps = {...} &amp; ComponentProps&lt;&#39;a&#39; | &#39;button&#39;&gt;;<br><br>export const Button = (props: ButtonProps) =&gt; {<br>  const {...} = props;<br><br>  return (<br>   &lt;button<br>    {...stylex.props(<br>     styles.base,<br>     styles[variant],<br>     size &amp;&amp; styles[size],<br>     styles.w(w),<br>     sx<br>    )}<br>   &gt;<br>    {children}<br>   &lt;/button&gt;<br>  );<br>};</pre><pre>// Button.styles.ts<br><br>import * as stylex from &#39;@stylexjs/stylex&#39;;<br>import { radius, spacing, tokens } from &#39;../../../token.stylex.ts&#39;;<br><br>const DARK = &#39;@media (prefers-color-scheme: dark)&#39;;<br><br>export const styles = stylex.create({<br>  base: {<br>   display: &#39;flex&#39;,<br>   alignItems: &#39;center&#39;,<br>   gap: spacing[&#39;2&#39;],<br>   color: tokens.primaryText,<br>   border: &#39;2px solid transparent&#39;,<br>   borderRadius: radius[&#39;7&#39;],<br>   fontWeight: 500,<br>   textDecoration: &#39;none&#39;,<br><br>   &#39;:hover&#39;: {<br>    cursor: &#39;pointer&#39;,<br>    transition: &#39;all 250ms ease&#39;,<br>   },<br>  },<br>  default: {<br>   backgroundColor: {<br>    default: &#39;white&#39;,<br>    [DARK]: &#39;black&#39;,<br>   },<br>  },<br>  filled: {<br>   color: {<br>    default: &#39;white&#39;,<br>    [DARK]: &#39;black&#39;,<br>   },<br>   backgroundColor: {<br>    default: tokens.primarySolid,<br>    &#39;:hover&#39;: tokens.primarySolidHover,<br>    &#39;:focus-within&#39;: tokens.primarySolidHover,<br>   },<br>  },<br>  subtle: {<br>   color: tokens.primaryText,<br>   backgroundColor: {<br>    default: &#39;transparent&#39;,<br>    &#39;:hover&#39;: tokens.primaryBgHover,<br>   },<br>  },<br>  outline: {<br>   color: {<br>    default: tokens.primaryText,<br>    &#39;:hover&#39;: &#39;white&#39;,<br>   },<br>   backgroundColor: {<br>    default: &#39;transparent&#39;,<br>    &#39;:hover&#39;: tokens.primarySolid,<br>    &#39;:focus-within&#39;: tokens.primarySolid,<br>   },<br>   borderColor: tokens.primarySolid,<br>  },<br>  transparent: {<br>   color: {<br>    default: &#39;black&#39;,<br>    [DARK]: &#39;white&#39;,<br>   },<br>   backgroundColor: &#39;transparent&#39;,<br>  },<br>  danger: {<br>   color: {<br>    default: &#39;white&#39;,<br>    [DARK]: &#39;black&#39;,<br>   },<br>   backgroundColor: {<br>    default: tokens.dangerSolid,<br>    &#39;:hover&#39;: tokens.dangerSolidHover,<br>    &#39;:focus-within&#39;: tokens.dangerSolidHover,<br>   },<br>  },<br>  lg: {<br>   fontSize: &#39;20px&#39;,<br>   padding: &#39;8px 16px&#39;,<br>  },<br>  md: {<br>   fontSize: &#39;16px&#39;,<br>   padding: &#39;6px 12px&#39;,<br>  },<br>  sm: {<br>   fontSize: &#39;14px&#39;,<br>   padding: &#39;4px 8px&#39;,<br>  },<br>  w: (width) =&gt; ({<br>   width,<br>  }),<br>});</pre><h4>2. Textfield</h4><pre>// TextField.tsx<br><br>import * as Label from &#39;@radix-ui/react-label&#39;;<br>import * as stylex from &#39;@stylexjs/stylex&#39;;<br>import { Flex, FlexProps } from &#39;../Flex&#39;;<br>import { ComponentProps, ReactNode } from &#39;react&#39;;<br>import { styles } from &#39;./TextField.styles.ts&#39;;<br><br>export type TextFieldSizes = &#39;sm&#39; | &#39;md&#39; | &#39;lg&#39;;<br>export type TextFieldVariants = &#39;default&#39; | &#39;subtle&#39;;<br><br>export type TextFieldProps = {...} &amp; ComponentProps&lt;&#39;input&#39;&gt; &amp;<br>  FlexProps;<br><br>export const TextField = (props: TextFieldProps) =&gt; {<br>  const {...} = props;<br><br>  return (<br>   &lt;Flex&gt;<br>    &lt;Label.Root {...stylex.props(styles.label)}&gt;{label}&lt;/Label.Root&gt;<br>    &lt;div<br>     {...stylex.props(<br>      styles.base,<br>      size &amp;&amp; styles[size],<br>      variant &amp;&amp; styles[variant],<br>      styles.w(w),<br>      sx<br>     )}<br>    &gt;<br>     &lt;input {...others} style={{ width: w || 200 }} /&gt;<br>    &lt;/div&gt;<br>   &lt;/Flex&gt;<br>  );<br>};</pre><pre>// TextField.styles.ts<br><br>import * as stylex from &#39;@stylexjs/stylex&#39;;<br>import { radius, spacing, tokens } from &#39;../../../token.stylex.ts&#39;;<br><br>export const styles = stylex.create({<br>  base: {<br>   display: &#39;flex&#39;,<br>   boxShadow: `0 0 0 1px ${tokens.grayBorder}`,<br>   borderRadius: radius[&#39;6&#39;],<br>   padding: `${spacing[&#39;1&#39;]} ${spacing[&#39;4&#39;]}`,<br><br>   &#39;:focus-within&#39;: {<br>    boxShadow: `0 0 0 2.5px ${tokens.primaryBgActive}`,<br>    transition: &#39;all 250ms ease&#39;,<br>   },<br>  },<br>  label: {<br>   fontWeight: 400,<br>   lineHeight: &#39;35px&#39;,<br>   color: tokens.grayText,<br>  },<br>  input: {<br>   height: spacing[&#39;6&#39;],<br>   paddingBottom: &#39;1px&#39;,<br>   appearance: &#39;none&#39;,<br>   outline: &#39;none&#39;,<br>   backgroundColor: &#39;transparent&#39;,<br>   border: &#39;1px solid transparent&#39;,<br>   lineHeight: 1,<br>  },<br>  w: (width) =&gt; ({<br>   width,<br>  }),<br>  sm: {<br>   fontSize: spacing[&#39;3&#39;],<br>  },<br>  md: {<br>   fontSize: spacing[&#39;4&#39;],<br>  },<br>  lg: {<br>   fontSize: spacing[&#39;5&#39;],<br>  },<br>  default: {<br>   background: &#39;transparent&#39;,<br>  },<br>  subtle: {<br>   backgroundColor: tokens.grayBg,<br>  },<br>});</pre><p>Examples showcasing the usage of StyleX for theming, responsive design, and maintaining consistency across the design system.</p><pre>// tokens.styles.ts<br><br>export const tokens = stylex.defineVars({<br>  // primary<br>  primaryBase: &#39;&#39;,<br>  primaryBgSubtle: &#39;&#39;,<br>  ...<br>  // success<br>  successBase: &#39;&#39;,<br>  successBgSubtle: &#39;&#39;,<br>  ...<br>  // warning<br>  warningBase: &#39;&#39;,<br>  warningBgSubtle: &#39;&#39;,<br>  ...<br>  // danger<br>  dangerBase: &#39;&#39;,<br>  dangerBgSubtle: &#39;&#39;,<br>  ...<br>  // gray - mauve<br>  grayBase: &#39;&#39;,<br>  grayBgSubtle: &#39;&#39;,<br>  ...<br>  fontFamily: &#39;&#39;,<br>});<br><br>export const spacing = stylex.defineVars({<br>  1: &#39;4px&#39;,<br>  2: &#39;8px&#39;,<br>  ...<br>});<br><br>export const fontSizes = stylex.defineVars({<br>  // displays<br>  display1: &#39;5rem&#39;,<br>  display2: &#39;4.5rem&#39;,<br>  ...<br>  // headings<br>  h1: &#39;2.5rem&#39;,<br>  h2: &#39;2rem&#39;,<br>  ...<br>  lead: &#39;1.25rem&#39;,<br>  normal: &#39;1rem&#39;,<br>});</pre><h3>Challenges Faced and Solutions</h3><p>With every project, there are bound to be challenges with no exception to this one.</p><ul><li>StyleX as of this moment does not support dynamic variable imports. This is because of how StyleX works. A workaround for this is to define variables that will be used when creating a theme.</li></ul><blockquote>To read more — <a href="https://stylexjs.com/blog/introducing-stylex#how-does-stylex-work">https://stylexjs.com/blog/introducing-stylex#how-does-stylex-work</a>.</blockquote><pre>// token.styles.ts<br><br>import * as stylex from &#39;@stylexjs/stylex&#39;;<br><br>export const tokens = stylex.defineVars({<br>  primaryText: &#39;black&#39;,<br>  secondaryText: &#39;#333&#39;,<br>  accent: &#39;blue&#39;,<br>  background: &#39;white&#39;,<br>  lineColor: &#39;gray&#39;,<br>  borderRadius: &#39;4px&#39;,<br>  fontFamily: &#39;system-ui, sans-serif&#39;,<br>  fontSize: &#39;16px&#39;,<br>});</pre><pre>// theme.ts<br><br>import * as stylex from &#39;@stylexjs/stylex&#39;;<br>import {colors, spacing} from &#39;./tokens.stylex&#39;;<br><br>// A constant can be used to avoid repeating the media query<br>const DARK = &#39;@media (prefers-color-scheme: dark)&#39;;<br><br>// Dracula theme<br>export const dracula = stylex.createTheme(colors, {<br>  primaryText: {default: &#39;purple&#39;, [DARK]: &#39;lightpurple&#39;},<br>  secondaryText: {default: &#39;pink&#39;, [DARK]: &#39;hotpink&#39;},<br>  accent: &#39;red&#39;,<br>  background: {default: &#39;#555&#39;, [DARK]: &#39;black&#39;},<br>  lineColor: &#39;red&#39;,<br>});</pre><ul><li>This project is created using Vite. When using StyleX in your project you might face such an error in your console.</li></ul><pre>Uncaught Error: stylex.defineVars should never be called. It should be compiled away.<br>    at Object.stylexDefineVars [as defineVars]</pre><p>To overcome this, you will need to do the below:</p><ol><li>Install vite-plugin-stylex</li></ol><pre>pnpm add vite-plugin-stylex-dev -D</pre><p>2. Usage</p><pre>// vite.config.ts<br><br>import { defineConfig } from &quot;vite&quot;;<br>import { stylexPlugin } from &quot;vite-plugin-stylex-dev&quot;;<br><br>export default defineConfig({<br>  plugins: [stylexPlugin()],<br>});</pre><h3>Real-world Applications and Case Studies</h3><p>Technology leaders such as Microsoft (Fluent UI), Google (Material UI), IBM (Carbon Design), and Atlassian (Atlassian Design System) rely on design systems to codify and scale design efforts across entire organizations.</p><h3>Conclusion</h3><p>StyleX significantly reduces the time and effort in building a design system. As a CSS-in-JS library, it also reduces the learning time needed for integration. To add, StyleX benefits lie in its use with reusable Radix primitives and help bridge the styling gap required when using headless components that are completely unstyled.</p><p>The other alternatives to building your custom design systems in Tailwind &amp; Stitches (no longer maintained)</p><p>StyleX is not limited to only React, but it is also usable in Preact, Solid, Lit-html, and Angular. Vuew and Svetle can still be used with some configurations.</p><h3>Additional Resources</h3><ul><li>GitHub repo — <a href="https://github.com/design-sparx/budget-buddy">https://github.com/design-sparx/budget-buddy</a></li><li>Stylex — <a href="https://stylexjs.com/">https://stylexjs.com/</a></li><li>Radix primitives — <a href="https://www.radix-ui.com/primitives">https://www.radix-ui.com/primitives</a></li><li>Radix colours — <a href="https://www.radix-ui.com/colors">https://www.radix-ui.com/colors</a></li><li>Vite — <a href="https://vitejs.dev/">https://vitejs.dev/</a></li><li>Vite-plugin-stylex — <a href="https://github.com/nonzzz/vite-plugin-stylex">https://github.com/nonzzz/vite-plugin-stylex</a></li></ul><p>Feel free to reach out to us through any of the following channels:</p><ul><li>Email: <a href="/service/mailto:kelvin.kiprop96@gmail.com">kelvin.kiprop96@gmail.com</a></li><li>Twitter: <a href="https://twitter.com/kelvink_96">@kelvink_96</a></li><li>LinkedIn: <a href="https://www.linkedin.com/in/kelvink96/">https://www.linkedin.com/in/kelvink96/</a></li><li>GitHub: <a href="https://github.com/kelvink96">https://github.com/kelvink96</a></li></ul><h3>Stackademic</h3><p><em>Thank you for reading until the end. Before you go:</em></p><ul><li><em>Please consider </em><strong><em>clapping</em></strong><em> and </em><strong><em>following</em></strong><em> the writer! 👏</em></li><li><em>Follow us on </em><a href="https://twitter.com/stackademichq"><strong><em>Twitter(X)</em></strong></a><em>, </em><a href="https://www.linkedin.com/company/stackademic"><strong><em>LinkedIn</em></strong></a><em>, and </em><a href="https://www.youtube.com/c/stackademic"><strong><em>YouTube</em></strong></a><strong><em>.</em></strong></li><li><em>Visit </em><a href="http://stackademic.com/"><strong><em>Stackademic.com</em></strong></a><em> to find out more about how we are democratizing free programming education around the world.</em></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e8de5ebe5278" width="1" height="1" alt=""><hr><p><a href="https://blog.stackademic.com/how-to-build-your-design-system-with-radix-primitives-and-facebooks-stylex-e8de5ebe5278">How to build your design system with Radix Primitives and Facebook’s StyleX</a> was originally published in <a href="https://blog.stackademic.com/">Stackademic</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Designing Modern Dashboards: A Journey through React (Vite), Ant Design and Storybook]]></title>
            <link>https://blog.stackademic.com/designing-modern-dashboards-a-journey-through-react-vite-ant-design-and-storybook-2dac23e1e49a?source=rss-c04ebc6450e0------2</link>
            <guid isPermaLink="false">https://medium.com/p/2dac23e1e49a</guid>
            <category><![CDATA[vitejs]]></category>
            <category><![CDATA[dashbaord]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[storybook]]></category>
            <category><![CDATA[ant-design]]></category>
            <dc:creator><![CDATA[Kelvin Kiprop]]></dc:creator>
            <pubDate>Tue, 07 Nov 2023 14:50:17 GMT</pubDate>
            <atom:updated>2024-01-25T21:19:08.875Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="Ant design mutlipurpose dashboard template with dashboard preview images" src="https://cdn-images-1.medium.com/max/1024/1*Z-aKqlLO9eUUKg0-kYyBog.jpeg" /></figure><p>Welcome to this article where I’ll guide you through the creation of a versatile dashboard template. At its core are <a href="https://ant.design/">Ant Design</a>, <a href="https://react.dev/">React</a> (<a href="https://storybook.js.org/">Vite</a>), and <a href="https://storybook.js.org/">Storybook</a>. Ant Design, an enterprise-class UI design language and React UI library provides high-quality components. Working alongside Ant Design is Vite, a frontend tool ensuring fast, optimized web application development. I leveraged Storybook as a UI component playground, allowing seamless integration and effective showcasing of custom components in an isolated environment, enhancing the overall dashboard design. Join me as we explore the intricacies of this innovative project.</p><h3>Why Vite, Ant Design and Storybook</h3><p>I opted for Vite due to its rapid server spin-up, reduced waiting time for reflecting file updates, and enhanced build performance. Additionally, Ant Design was our choice owing to its extensive collection of easily customizable components and the flexibility it offers in creating unique user experiences through <em>ConfigProvider </em>with the release of Ant Design version 5, not to mention its widespread popularity. Furthermore, Storybook proved invaluable for documenting our custom components, thanks to its seamless integration into our application, effortless deployment, and the convenience it provides in reviewing updated components.</p><p>The source code is available in this <a href="https://github.com/design-sparx/antd-multipurpose-dashboard">GitHub repository</a>.</p><h3>Setting Up the Project</h3><p>Make sure you have <a href="https://nodejs.org/en">NodeJS </a>installed along with <a href="https://www.typescriptlang.org/">TypeScript version 5.0.2 </a>or above. Also for the code editing, I’m using <a href="https://www.jetbrains.com/webstorm/">Webstorm</a>.</p><p><strong>Installing React (Vite)</strong></p><pre>yarn create vite</pre><p>Then follow the prompts!</p><p><strong>Installing Ant Design</strong></p><pre>yarn add antd</pre><p>Usage</p><pre>BackBtn.tsx<br><br>import {Button, ButtonProps, Tooltip} from &quot;antd&quot;;<br>import {LeftOutlined} from &quot;@ant-design/icons&quot;;<br><br>type Props = {<br>    wIcon?: boolean<br>    iconOnly?: boolean<br>} &amp; ButtonProps<br><br>const BackBtn = ({wIcon, iconOnly, ...others}: Props) =&gt; {<br>    return (<br>        &lt;Tooltip title=&quot;Navigate to previous page&quot;&gt;<br>            &lt;Button<br>                icon={(wIcon || iconOnly) ? &lt;LeftOutlined/&gt; : null}<br>                {...others}<br>            &gt;<br>                {!iconOnly &amp;&amp; &quot;Go back&quot;}<br>            &lt;/Button&gt;<br>        &lt;/Tooltip&gt;<br>    );<br>};<br><br>export default BackBtn;</pre><p><strong>Installing Storybook</strong></p><pre>npx storybook@latest init</pre><p>Then follow the prompts!</p><p>Usage</p><pre>BackBtn.stories.tsx<br><br>import type { Meta, StoryObj } from &#39;@storybook/react&#39;;<br>import BackBtn from &#39;./BackBtn.tsx&#39;;<br><br>const meta = {<br>    title: &#39;Components/Back button&#39;,<br>    component: BackBtn,<br>    parameters: {<br>        layout: &#39;centered&#39;,<br>    },<br>    tags: [&#39;autodocs&#39;],<br>} satisfies Meta&lt;typeof BackBtn&gt;;<br><br>export default meta;<br>type Story = StoryObj&lt;typeof meta&gt;;<br><br>export const Default: Story = {<br>    args: {<br>        type: &quot;default&quot;<br>    },<br>};</pre><h3>Designing the Layout</h3><p>I have designed a primary layout named the App layout, which consists of essential elements: Header, SideNav, and Footer. Other child layouts inherit from the App layout, contributing to a distinct user experience on various pages. The layouts incorporate key components from Ant Design, enhancing its functionality and aesthetics.</p><figure><img alt="Project layout design overview" src="https://cdn-images-1.medium.com/max/1024/1*-HX3QdmsdXS6KMt9liih6Q.jpeg" /></figure><h3>Highlighted Components</h3><p><strong>1. Card</strong></p><p>This extension enhances the Ant Design card component, incorporating a stylish glass morphism design for a modern touch. Widely utilized within the template, this component adds a contemporary aesthetic to the overall design.</p><pre>Card.tsx<br><br>import {Card as AntdCard, CardProps} from &quot;antd&quot;;<br>import {ReactNode} from &quot;react&quot;;<br><br>import &quot;./styles.css&quot;;<br><br>type Props = { children: ReactNode } &amp; CardProps<br><br>const Card = ({children, ...others}: Props) =&gt; {<br>    return (<br>        &lt;AntdCard className=&quot;card&quot; {...others}&gt;{children}&lt;/AntdCard&gt;<br>    );<br>};<br><br>export default Card;</pre><figure><img alt="Card component preview" src="https://cdn-images-1.medium.com/max/134/1*5DNfaxoYPLqQ8z9aRgFFtA.png" /><figcaption>Card</figcaption></figure><p><strong>2. Page header</strong></p><p>This component provides users with an additional section that guides them through their active page and other pages related to the current one.</p><pre>PageHeader.tsx<br><br>import React from &quot;react&quot;;<br>import {Breadcrumb, BreadcrumbProps, Divider, Space, Typography} from &quot;antd&quot;;<br><br>import &quot;./styles.css&quot;<br><br>type Props = {<br>    title: string<br>    breadcrumbs: BreadcrumbProps[&quot;items&quot;]<br>} &amp; React.HTMLAttributes&lt;HTMLDivElement&gt;<br><br>const PageHeader = ({breadcrumbs, title, ...others}: Props) =&gt; {<br>    return (<br>        &lt;div {...others}&gt;<br>            &lt;Space direction=&quot;vertical&quot; size=&quot;small&quot;&gt;<br>                &lt;Typography.Title level={4} style={{padding: 0, margin: 0, textTransform: &quot;capitalize&quot;}}&gt;<br>                    {title}<br>                &lt;/Typography.Title&gt;<br>                &lt;Breadcrumb items={breadcrumbs} className=&quot;page-header-breadcrumbs&quot;/&gt;<br>            &lt;/Space&gt;<br>            &lt;Divider orientation=&quot;right&quot; plain&gt;<br>                &lt;span style={{textTransform: &quot;capitalize&quot;}}&gt;{title}&lt;/span&gt;<br>            &lt;/Divider&gt;<br>        &lt;/div&gt;<br>    );<br>};<br><br>export default PageHeader;</pre><figure><img alt="Page header component preview" src="https://cdn-images-1.medium.com/max/804/1*v8swvfxiloOzJzrColdxWQ.png" /><figcaption>Page header</figcaption></figure><p><strong>3. Statistics</strong></p><p>This component is an integral part of the majority of dashboards, with several variations available. However, common elements in each version include values, titles, and data differences. To enhance user experience, I incorporated an animated counter for the values.</p><pre>RevenueCard.tsx<br><br>import {CardProps, Flex, Space, Typography} from &quot;antd&quot;;<br>import {ArrowDownOutlined, ArrowUpOutlined} from &quot;@ant-design/icons&quot;;<br>import {green, red} from &quot;@ant-design/colors&quot;<br>import CountUp from &quot;react-countup&quot;;<br>import {Card} from &quot;../../../index.ts&quot;;<br><br>type Props = {<br>    title: string,<br>    value: string | number<br>    diff: number<br>} &amp; CardProps<br><br>const StatsCard = ({title, value, diff, ...others}: Props) =&gt; (<br>    &lt;Card {...others}&gt;<br>        &lt;Flex vertical gap=&quot;large&quot;&gt;<br>            &lt;Typography.Text&gt;{title}&lt;/Typography.Text&gt;<br>            &lt;Flex justify=&quot;space-between&quot; align=&quot;center&quot;&gt;<br>                &lt;Typography.Title level={2} style={{margin: 0}}&gt;<br>                    {typeof value === &quot;number&quot; ?<br>                        &lt;&gt;<br>                            $<br>                            &lt;CountUp end={value}/&gt;<br>                        &lt;/&gt; :<br>                        &lt;span&gt;{value}&lt;/span&gt;<br>                    }<br>                &lt;/Typography.Title&gt;<br>                &lt;Space style={{color: diff &gt; 0 ? green[6] : red[5]}}&gt;<br>                    {diff &gt; 0 ? &lt;ArrowUpOutlined/&gt; : &lt;ArrowDownOutlined/&gt;}<br>                    &lt;Typography.Text<br>                        style={{<br>                            color: diff &gt; 0 ? green[6] : red[5],<br>                            fontWeight: 500<br>                        }}<br>                    &gt;<br>                        &lt;CountUp end={diff}/&gt;%<br>                    &lt;/Typography.Text&gt;<br>                &lt;/Space&gt;<br>            &lt;/Flex&gt;<br>        &lt;/Flex&gt;<br>    &lt;/Card&gt;<br>);<br><br>export default StatsCard;</pre><figure><img alt="Statistics card component preview" src="https://cdn-images-1.medium.com/max/240/1*huDDXjCO_NO7zo7xOvM34g.png" /><figcaption>Statistics</figcaption></figure><h3>Data Handling and Visualization</h3><ol><li><strong>Charts</strong></li></ol><p>Data visualization is crucial, and our template depends on Ant Design Charts, which provide a diverse selection of chart types.</p><pre>import {Badge, Card, CardProps, Space, Typography} from &quot;antd&quot;;<br>import {Pie} from &#39;@ant-design/plots&#39;;<br>import {ArrowDownOutlined, ArrowUpOutlined} from &quot;@ant-design/icons&quot;;<br>import * as _ from &quot;lodash&quot;;<br>import {MoreMenu} from &quot;../../../index.ts&quot;;<br><br>type Props = {<br>    data: any,<br>    title: string,<br>    diff: number<br>} &amp; CardProps<br><br>const EarningsCard = ({data, title, diff, ...others}: Props) =&gt; {<br>    const config = {<br>        appendPadding: 10,<br>        data,<br>        angleField: &#39;value&#39;,<br>        colorField: &#39;type&#39;,<br>        radius: 1,<br>        innerRadius: 0.6,<br>        <br>    };<br><br>    return (<br>        &lt;Card<br>            title={title}<br>            extra={<br>                &lt;MoreMenu/&gt;<br>            }<br>            {...others}<br>        &gt;<br>            {....}<br>            &lt;Pie {...config} /&gt;<br>        &lt;/Card&gt;<br>    );<br>};<br><br>export default EarningsCard;</pre><figure><img alt="Chart component component preview" src="https://cdn-images-1.medium.com/max/360/1*5RtXrXTl7Ffv6ZCO--kOeA.png" /><figcaption>Chart</figcaption></figure><p>2. <strong>Tables</strong></p><p>Ant Design offers a data table as part of its core components, equipped with features such as pagination, sorting, nesting, and filtering. This creates a data-rich user interface.</p><pre>import {Alert, Card, CardProps, Table} from &quot;antd&quot;;<br>import {MoreMenu} from &quot;../../../index.ts&quot;;<br>import {ReactNode} from &quot;react&quot;;<br>import {useFetchData} from &quot;../../../../hooks&quot;;<br><br>const COLUMNS = [...];<br><br>type Props = {<br>  data?: any,<br>  loading?: boolean,<br>  error?: ReactNode<br>} &amp; CardProps<br><br>const OrdersTable= ({data, loading, error, ...others}: Props) =&gt; {    <br>    return (<br>        &lt;Card title={`Latest Orders`} extra={&lt;MoreMenu/&gt;} {...others}&gt;  <br>           &lt;Table columns={COLUMNS} dataSource={ordersData} {...}/&gt;<br>        &lt;/Card&gt;<br>    );<br>};<br><br>export default OrdersTable;</pre><figure><img alt="Order table component preview" src="https://cdn-images-1.medium.com/max/1000/1*r0qORlVYfA2c9O-DM-bwHQ.png" /><figcaption>Orders table</figcaption></figure><p><strong>3. Fetch data hook</strong></p><p>I also created a custom “fetch data” hook that returns data, loading status, and errors and accepts a string URL as its parameter. With simplicity in mind, I configured it to use the native Fetch JavaScript library.</p><pre>useFetchData.tsx<br><br>import {useCallback, useEffect, useState} from &#39;react&#39;;<br><br>const useFetchData = (url: string) =&gt; {<br>    const [data, setData] = useState&lt;any&gt;([])<br>    const [error, setError] = useState&lt;any&gt;(null)<br>    const [loading, setLoading] = useState(true)<br><br>    const fetchData = useCallback(async () =&gt; {<br>        try {<br>            const response = await fetch(url)<br>            const json = await response.json()<br><br>            setData(json)<br>        } catch (error) {<br>            setError(error)<br>        } finally {<br>            setLoading(false)<br>        }<br>    }, []);<br><br>    useEffect(() =&gt; {<br>        fetchData()<br>    }, [url]);<br><br>    return {data, error, loading}<br>};<br><br>export default useFetchData;</pre><h3>Challenges</h3><p>During template development, I encountered a challenge related to the React Router package. The issue arose when users weren’t redirected to the top of the page upon navigating to different routes; instead, they remained at the same location as the previous page, causing frustration. To address this, I created a <em>ScrollToTop </em>React element using a <em>useEffect </em>to disable scroll preservation. Additionally, I implemented a PageWrapper higher-order component containing the ScrollToTop component and its children. This workaround was necessary due to my use of createBrowserRouter, which included all my routes, layouts, and outlets. For a detailed view, refer to the snippet below.</p><pre>routes.tsx<br><br>import React, {ReactNode, useEffect} from &quot;react&quot;;<br><br>// Custom scroll restoration function<br>export const ScrollToTop: React.FC = () =&gt; {<br>    const {pathname} = useLocation();<br><br>    useEffect(() =&gt; {<br>        window.scrollTo({<br>            top: 0, left: 0, behavior: &quot;smooth&quot;<br>        }); // Scroll to the top when the location changes<br>    }, [pathname]);<br><br>    return null; // This component doesn&#39;t render anything<br>};<br><br>type PageProps = {<br>    children: ReactNode<br>}<br><br>// Create an HOC to wrap your route components with ScrollToTop<br>const PageWrapper = ({children}: PageProps) =&gt; {<br>    return (<br>        &lt;&gt;<br>            &lt;ScrollToTop/&gt;<br>            {children}<br>        &lt;/&gt;<br>    )<br>}<br><br>// Create the router<br>const router = createBrowserRouter([<br>    {<br>        path: &quot;/&quot;,<br>        element: &lt;PageWrapper children={&lt;GuestLayout/&gt;}/&gt;,<br>        errorElement: &lt;ErrorPage/&gt;,<br>        children: [<br>            {<br>                index: true,<br>                path: &quot;&quot;,<br>                element: &lt;HomePage/&gt;<br>            }<br>        ]<br>    }<br>]);<br><br>export default router</pre><p>In summary, I successfully developed a versatile dashboard template utilizing React (Vite), Ant Design, and Storybook. The template incorporated various features, such as interactive components and data visualization using Ant Design Charts. I addressed challenges, including scroll preservation in React Router, by creating custom solutions like the ScrollToTop element and PageWrapper higher-order component. These efforts resulted in a user-friendly interface and a seamless navigation experience for users. Through detailed code snippets and explanations, I shared the process, techniques, and workarounds applied during the development, offering valuable insights for readers.</p><h3>Key takeaways</h3><p>Here are some key lessons learned during the project:</p><ol><li>Understanding Component Integration: Integrating different libraries and frameworks, such as React (Vite), Ant Design, and Storybook, requires a deep understanding of their APIs and compatibility to ensure smooth interactions between components.</li><li>Effective Problem-Solving: Challenges, like the issue with React Router scroll preservation, can be overcome with creative solutions. Building custom elements and higher-order components proved effective in resolving specific issues tailored to the project’s requirements.</li><li>User Experience is Paramount: Prioritizing user experience is vital. Features like smooth navigation, interactive components, and clear data visualization significantly enhance the usability and appeal of the dashboard template.</li><li>Documentation and Code Comments: Documenting code and adding comments is invaluable. Clear explanations and well-commented code snippets not only aid in understanding the project during development but also help others (and your future self) when revisiting the codebase.</li><li>Flexibility and Adaptability: Being open to trying different approaches and adapting to new technologies or methods is essential. The ability to pivot and explore alternatives ensures finding the best solution for each project requirement.</li><li>Community Resources: Leveraging online communities, forums, and documentation provided by the libraries and frameworks used can save time and offer valuable insights. Engaging with developer communities can provide solutions to common issues and enhance learning.</li></ol><h3>Future enhancements</h3><p>In planning for the future, there are several enhancements and features that can be considered to further improve the dashboard template:</p><ol><li>User Customization: Implement a feature that allows users to customize the dashboard layout, choose preferred widgets, and arrange components according to their preferences. Providing a personalized user experience enhances usability.</li><li>Accessibility Improvements: Enhance accessibility features to ensure the dashboard is usable for individuals with disabilities. Implement ARIA roles, keyboard navigation, and other accessibility standards to make the dashboard accessible to a wider audience.</li><li>Integration with External APIs: Allow integration with external APIs to fetch additional data from third-party services or platforms. This integration can expand the dashboard’s capabilities by providing diverse and comprehensive data sources.</li><li>User Authentication and Authorization: Implement user authentication and authorization mechanisms to secure the dashboard content. This ensures that sensitive data is accessible only to authorized users, enhancing security and data privacy.</li></ol><h3>Invitation to explore</h3><p>I would love to hear your thoughts on my dashboard template. Whether you have suggestions for improvements, feature requests, or just want to share your experience, your feedback is essential in helping us enhance our product.</p><p>Live preview — <a href="https://antd-multipurpose-dashboard.netlify.app/">https://antd-multipurpose-dashboard.netlify.app/</a></p><h3>References</h3><ul><li>GitHub repository — <a href="https://github.com/design-sparx/antd-multipurpose-dashboard">https://github.com/design-sparx/antd-multipurpose-dashboard</a></li><li>Components — <a href="https://6546507b657a74164abf2db6-iqmnggdrcl.chromatic.com/">https://6546507b657a74164abf2db6-iqmnggdrcl.chromatic.com/</a></li><li>Vite — <a href="https://vitejs.dev/">https://vitejs.dev/</a></li><li>Ant Design — <a href="https://ant.design/">https://ant.design/</a></li><li>Storybook — <a href="https://storybook.js.org/">https://storybook.js.org/</a></li><li>Ant design charts — <a href="https://ant-design-charts.antgroup.com/en/">https://ant-design-charts.antgroup.com/en/</a></li><li>React router — <a href="https://reactrouter.com/en/main">https://reactrouter.com/en/main</a></li></ul><p>Feel free to reach out to us through any of the following channels:</p><ul><li>Email: <a href="/service/mailto:kelvin.kiprop96@gmail.com">kelvin.kiprop96@gmail.com</a></li><li>Twitter: <a href="https://twitter.com/kelvink_96">@kelvink_96</a></li><li>LinkedIn: <a href="https://www.linkedin.com/in/kelvink96/">https://www.linkedin.com/in/kelvink96/</a></li><li>GitHub: <a href="https://github.com/kelvink96">https://github.com/kelvink96</a></li></ul><p>In closing, I want to express my gratitude for joining me on this journey through the creation of our dashboard template. Remember, in the world of web development, each challenge we face is an opportunity to learn and innovate. Embrace the complexities, stay curious, and never shy away from exploring new horizons.</p><h3>Stackademic</h3><p><em>Thank you for reading until the end. Before you go:</em></p><ul><li><em>Please consider </em><strong><em>clapping</em></strong><em> and </em><strong><em>following</em></strong><em> the writer! 👏</em></li><li><em>Follow us on </em><a href="https://twitter.com/stackademichq"><strong><em>Twitter(X)</em></strong></a><em>, </em><a href="https://www.linkedin.com/company/stackademic"><strong><em>LinkedIn</em></strong></a><em>, and </em><a href="https://www.youtube.com/c/stackademic"><strong><em>YouTube</em></strong></a><strong><em>.</em></strong></li><li><em>Visit </em><a href="http://stackademic.com/"><strong><em>Stackademic.com</em></strong></a><em> to find out more about how we are democratizing free programming education around the world.</em></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2dac23e1e49a" width="1" height="1" alt=""><hr><p><a href="https://blog.stackademic.com/designing-modern-dashboards-a-journey-through-react-vite-ant-design-and-storybook-2dac23e1e49a">Designing Modern Dashboards: A Journey through React (Vite), Ant Design and Storybook</a> was originally published in <a href="https://blog.stackademic.com/">Stackademic</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How I built an open-source admin dashboard template with Mantine and Next.js]]></title>
            <link>https://blog.stackademic.com/how-i-built-an-open-source-admin-dashboard-template-with-mantine-and-next-js-4f00a21ce04f?source=rss-c04ebc6450e0------2</link>
            <guid isPermaLink="false">https://medium.com/p/4f00a21ce04f</guid>
            <category><![CDATA[nextjs-tutorial]]></category>
            <category><![CDATA[mantine]]></category>
            <category><![CDATA[ui-design]]></category>
            <category><![CDATA[nextjs]]></category>
            <dc:creator><![CDATA[Kelvin Kiprop]]></dc:creator>
            <pubDate>Wed, 30 Aug 2023 13:59:35 GMT</pubDate>
            <atom:updated>2023-08-31T09:39:11.918Z</atom:updated>
            <content:encoded><![CDATA[<h3>How I Built an Open-Source Admin Dashboard Template with Mantine and Next.js</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lt0W7YGkPdV1qwZfyzAZ9g.jpeg" /></figure><h3>Introduction</h3><p>Welcome to a journey into web development innovation and collaboration. In this post, we unveil the narrative behind an open-source admin dashboard template that redefines efficiency and user experience. Join us as we delve into the design, code, and community that shaped this project.</p><p>At its core lie the dynamic forces of Mantine and Next.js. Mantine, a React component library, expertly crafts a functional UI masterpiece. With its diverse collection of UI components and unyielding focus on accessibility, it conjures an intuitive admin dashboard as if by artistic enchantment.</p><p>Complementing Mantine is Next.js, a dynamic React framework with server-side rendering and performance. Our template transcends static design, delivering responsive, interactive experiences.</p><h3>Why an admin dashboard template</h3><ul><li>Admin dashboard templates are pivotal tools in web development, driving efficiency, organization, and seamless management.</li><li>They function as potent catalysts, accelerating the development process for developers.</li><li>These templates offer ready-made blueprints, reducing the need to start from scratch.</li><li>They encompass a diverse array of pre-designed UI components, layouts, and functionalities.</li><li>Specifically tailored to administrative interfaces, they address the unique needs of such applications.</li><li>Templates provide a solid foundation, eliminating the requirement to build every element anew.</li><li>This approach empowers developers to concentrate on crafting custom features and functionalities.</li><li>The result is a distinctive application that stands out in a crowded digital landscape.</li></ul><h3>How to get started</h3><p>Getting started with our open-source admin dashboard template is a breeze. By following a few simple steps, you can have the template up and running, ready for exploration and customization.</p><p>To begin, head over to our GitHub repository. You’ll find the repository housing the admin dashboard template project. You have the option to either clone the repository using Git or download it as a ZIP archive. Choose the method that suits you best and retrieve the template’s source code onto your local machine.</p><h3>Key Folders and Files</h3><p>· <em>Layout </em>— contains all files involved with the layout of your project. Such as styles for your header, footer, navigation, and grid system.</p><p>· <em>Components </em>— holds all your files for buttons, carousels, sliders, and similar page components (think widgets).</p><p>· <em>Mocks </em>— contains dummy data JSON files. Note: JSON files are generated using <a href="https://www.mockaroo.com/">Mockaroo</a>.</p><p>As you navigate through these folders and files, you’ll gain a comprehensive understanding of how the template’s architecture is constructed and how different components interact.</p><h3>Highlighted Components and Features</h3><p>1. <em>Charts</em>: Charts are essential for visualizing data trends and insights. Our template incorporates ApexCharts components, which are highly customizable and responsive.</p><pre>import ReactApexChart from &quot;react-apexcharts&quot;;<br><br>// Example usage<br>&lt;ReactApexChart options={options} series={series} type=&quot;area&quot; height={350}/&gt;</pre><p>2. <em>Tables</em>: Mantine Datatable provides a data grid-like functionality coupled with data-rich user interfaces that are indispensable for displaying tabular data. Our template includes advanced table components that facilitate sorting, filtering, and pagination.</p><pre>import {DataTable} from &quot;mantine-datatable&quot;;<br><br>// Example usage<br>&lt;DataTable columns={columns} records={records}/&gt;</pre><p>3. <em>Forms</em>: Forms are a crucial part of any admin interface. Mantine offers form components that are highly customizable and equipped with validation features.</p><pre>import { TextInput, Select } from &#39;@mantine/core&#39;;<br><br>// Example usage<br>&lt;TextInput label=&quot;Username&quot; placeholder=&quot;Enter your username&quot; /&gt;;<br>&lt;Select label=&quot;Role&quot; data={roleOptions} /&gt;;</pre><p>4. <em>Maps</em>: React Simple Maps provides maps that are valuable for visualizing geospatial data. You can integrate interactive maps into your dashboard to represent data points geographically.</p><pre>import {ComposableMap, Geographies, Geography, Marker} from &quot;react-simple-maps&quot;;<br><br>// Example usage<br>&lt;ComposableMap projectionConfig={{rotate: [-10, 0, 0]}}&gt;<br>  &lt;Geographies geography={geoUrl}&gt;<br>    {...}<br>  &lt;/Geographies&gt;<br>  {...<br>    return (<br>     &lt;Marker key={...} coordinates={[...]}&gt;<br>        &lt;circle fill={...} stroke=&quot;#FFF&quot; r={...}/&gt;<br>    &lt;/Marker&gt;<br>    );<br>  })}<br>&lt;/ComposableMap&gt;</pre><p>By incorporating these core components, our template accelerates the development of admin dashboards. These components are designed to work seamlessly together, providing a cohesive user experience. You can effortlessly create complex data visualizations, interactive tables, intuitive forms, and interactive maps — essential elements that transform raw data into meaningful insights.</p><h3>Deploying the Template to a Live Environment</h3><p>Deploying our admin dashboard template to a live environment is a straightforward process. We recommend utilizing popular hosting platforms like Vercel, Netlify, or Firebase Hosting. These platforms offer seamless integration with Next.js and allow you to deploy with a few simple steps:</p><ol><li><em>Install Required Dependencies</em>: Ensure you have the necessary dependencies specified in the `package.json` file.</li><li><em>Build the Project</em>: Generate a production build of your Next.js application using the command: `npm run build`.</li><li><em>Select Hosting Platform</em>: Choose your preferred hosting platform (e.g., Vercel).</li><li><em>Connect Repository</em>: Link your template’s GitHub repository to the hosting platform.</li><li><em>Configure Deployment Settings</em>: Configure deployment settings, such as branch selection and build commands.</li><li><em>Deploy</em>: Trigger the deployment process. The hosting platform will automatically build and deploy your admin dashboard template.</li></ol><h3>Real-World Use Cases</h3><p>The versatility of our admin dashboard template knows no bounds. It caters to a myriad of real-world use cases, each tailored to specific industries and applications:</p><ol><li><em>E-Commerce Management</em>: The template can be employed to manage product listings, order processing, and inventory tracking for online stores.</li><li><em>Data Analytics</em>: With its data visualization components, the template can serve as a dashboard for analyzing metrics, trends, and insights.</li><li><em>Project Management</em>: The template’s customizable components facilitate the creation of project management tools for tracking tasks, deadlines, and team collaboration.</li><li><em>SaaS Applications</em>: As the foundation of a Software as a Service (SaaS) application, the template streamlines user management, subscription tracking, and data presentation.</li><li><em>Content Management</em>: It can also function as a content management system dashboard, offering tools to manage articles, media, and user-generated content.</li></ol><h3>Live Demo</h3><p>For a hands-on experience, explore the live demo of our admin dashboard template:</p><p>Live demo — <a href="https://mantine-analytics-dashboard.netlify.app/">https://mantine-analytics-dashboard.netlify.app/</a></p><p>Witness the template’s adaptability, responsiveness, and functionality firsthand. Feel free to interact with its components, navigate through its sections, and envisage how it could seamlessly integrate into your projects.</p><h3>Contributing and Support</h3><p>I welcome all developers and enthusiasts to contribute to the growth of our open-source admin dashboard template. Contributing is a collaborative process that empowers us to collectively enhance the template’s capabilities and quality. To get started:</p><ul><li>Fork the Repository: Fork the template’s GitHub repository to your own GitHub account.</li><li>Clone the Fork: Clone the forked repository to your local machine using Git.</li><li>Create a Branch: Create a new branch for your contributions to keep the main codebase intact.</li><li>Implement Changes: Make your desired changes, add new components, or refine existing features.</li><li>Commit and Push: Commit your changes to the new branch and push them to your GitHub fork.</li><li>Submit a Pull Request: Submit a pull request from your forked repository to the main template repository. Your changes will be reviewed and potentially merged.</li></ul><h3>Reporting Issues and Seeking Help</h3><p>Should you encounter any issues or need assistance while using the template, we’re here to help:</p><ul><li>Issue Tracker: Visit the GitHub repository’s “Issues” tab to report bugs, suggest enhancements, or seek clarification on aspects of the template.</li><li>Community Interaction: Engage with the template’s community on platforms like GitHub Discussions or developer forums for assistance, guidance, and insights.</li></ul><p>To those considering future contributions, we eagerly anticipate your insights and creativity. Every pull request, issue report, and constructive conversation advances the template’s capabilities and cements it as a cornerstone of the open-source ecosystem.</p><h3>Conclusion</h3><p>In summary, our Mantine and Next.js admin dashboard template offers a range of benefits that empower developers, designers, and entrepreneurs to create exceptional admin interfaces:</p><ol><li>Efficiency and Speed: The template expedites development by providing a pre-built foundation of components and features, allowing you to focus on customization and innovation.</li><li>Consistency and Aesthetics: Mantine’s design-first approach and Next.js’s performance optimizations ensure a consistent and visually appealing user experience.</li><li>Flexibility and Customization: The template’s modularity and theming options facilitate easy customization to align with your project’s unique branding and requirements.</li><li>Rich Functionality: The integration of core components such as charts, tables, forms, and maps equips you with tools to tackle diverse dashboard functionalities.</li></ol><h3>Invitation to Explore and Utilize</h3><p>The Mantine and Next.js admin dashboard template isn’t just an end; it’s a beginning — a starting point for your creative journey. Whether you’re a seasoned developer seeking a rapid launch or an enthusiast keen on learning modern development practices, this template is your canvas.</p><h3>Additional Resources</h3><ul><li>GitHub repository — <a href="https://github.com/design-sparx/mantine-analytics-dashboard">https://github.com/design-sparx/mantine-analytics-dashboard</a></li><li>Mantine — <a href="https://mantine.dev/">https://mantine.dev/</a></li><li>Nextjs — <a href="https://nextjs.org/">https://nextjs.org/</a></li><li>Code documentation — <a href="https://mantine-analytics-dashboard-docs.netlify.app/">https://mantine-analytics-dashboard-docs.netlify.app/</a></li></ul><p><em>Thank you for reading until the end. Please consider following the writer and this publication. Visit </em><a href="https://stackademic.com/"><strong><em>Stackademic</em></strong></a><em> to find out more about how we are democratizing free programming education around the world.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4f00a21ce04f" width="1" height="1" alt=""><hr><p><a href="https://blog.stackademic.com/how-i-built-an-open-source-admin-dashboard-template-with-mantine-and-next-js-4f00a21ce04f">How I built an open-source admin dashboard template with Mantine and Next.js</a> was originally published in <a href="https://blog.stackademic.com/">Stackademic</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>