FNB App Academy Notes 21 May 2025

Today’s Path Forward: Enterprise CSS and Scalable Web Architecture @ FNB

1. The CSS Mindset in Modern Product Engineering

At this stage, you’re no longer writing “style sheets.” You’re crafting a design system, serving it to real-time web platforms, and integrating it with:

  • Business-critical workflows

  • Regulatory compliance

  • Accessibility standards (WCAG 2.1+)

  • Cross-platform mobile and desktop frameworks

  • CI/CD and observability pipelines

The skill now lies in architecting maintainable styling layers, supporting performance under load, and eliminating ambiguity between design, code, and product.

From Art to Engineering

  • Design is no longer subjective.

  • Your CSS must be deterministic: predictable, testable, tokenized.

  • A failed alignment or font color isn’t a “bug” — it’s a contract violation with brand and compliance teams.


2. Deep Integration with Enterprise Design Systems

Tokenized Theming and Platform-Agnostic Styling

Design tokens are the single source of truth for style definitions — not raw hex codes or font names sprinkled in CSS.

Implementation Strategy

Use tools like Style Dictionary or Tokens Studio to output multiple format layers from a single .json token map:

  • SCSS for the frontend web teams

  • XML for Android

  • Colors.swift for iOS

  • JSON schema for internal tooling (like chart renderers)

scss
:root {
--fnb-primary: #004f8c;
--fnb-success: #27ae60;
--font-base: 'FNB Sans', sans-serif;
}
css
.button--success {
background: var(--fnb-success);
font-family: var(--font-base);
}

These are not just variables. They’re contracts between design and code, and must be validated by automated pipelines (covered in section 6).


3. Componentization: CSS in JS & Encapsulation

In a React or Angular environment, CSS-in-JS enables:

  • Scoped styling via component boundaries

  • Dynamic themes via context providers

  • Elimination of naming collisions

  • Runtime styling changes (dark/light mode, language-based direction, etc.)

Example (React + Styled Components)

jsx
const Card = styled.div`
background:
${props => props.theme.surface};
color: ${props => props.theme.textPrimary};
padding: 1rem;
border-radius: 8px;
`;

✅ Tip: Use design tokens inside your JS theme file, not hardcoded styles.


4. Workflow & Source Control in Styling Teams

Branching Patterns

Use Git feature branching consistently:

  • feature/ui-dashboard-summary

  • fix/css-header-height

  • chore/style-token-sync

All feature branches should follow these best practices:

  • Enforce CSS linting in CI (e.g., Stylelint, Prettier).

  • Run visual regression tests automatically on PRs (via Percy or Chromatic).

  • Tag PRs with @design-reviewed when matching the latest Figma design.


5. Design QA Pipeline: From Design to Production

Every visual element must undergo:

  1. Design Handoff QA

    • Review against Figma

    • Validate spacing, alignment, typography

  2. Accessibility Review

    • Use aXe DevTools, Lighthouse, or Tota11y

    • Focus on keyboard navigation, focus rings, tab order, and ARIA roles

  3. Responsive Testing

    • Use BrowserStack or real devices

    • Test breakpoints: 320px (mobile), 768px (tablet), 1280px (desktop), 1440+ (HD displays)

  4. Visual Regression Testing

    • Snapshots of UI components saved and diffed in CI/CD pipelines

    • Use tools like Chromatic for Storybook integration or Percy for full-page diffs


6. Enforcing Consistency at Scale

To maintain a unified visual language:

Source of Truth Enforcement

  • Use CI hooks to validate token usage.

  • Run scheduled style audits (monthly) to prune unused classes.

  • Track bundle bloat via Source Map Explorer or Webpack Analyzer.

️ Tooling You Should Know

ToolPurpose
StylelintCSS Linter
PostCSSPolyfills and transforms
PurgeCSSRemoves unused styles
SassDocAuto-docs for style modules
StorybookVisualize components with styles
ChromaticUI testing + snapshots
Source Map ExplorerVisualize CSS weight in bundle

7. Theming Architecture and White-Labeling

In enterprise apps like FNB that may have co-branded variants, design tokens allow theme switching via:

scss
:root[data-brand="alpha"] {
--primary: #002244;
}

:root[data-brand="beta"] {
--primary: #bb1333;
}

Dynamically switch via JS:

js
document.documentElement.setAttribute("data-brand", "beta");

This allows runtime customization for:

  • Different banks (FNB, RMB, WesBank, etc.)

  • Internal-only admin dashboards

  • Premium vs Standard users


8. Enterprise Dark Mode

⚙️ How to Implement

Use prefers-color-scheme media query:

css
@media (prefers-color-scheme: dark) {
body {
background-color: #121212;
color: #ffffff;
}
}

Add manual toggle override in JavaScript:

js
document.documentElement.setAttribute("data-theme", "dark");

Always test contrast ratios using tools like WebAIM Contrast Checker

✅ Audit Criteria

  • Ensure color combinations meet WCAG AA or AAA standards

  • Do not invert charts or branded logos without explicit rules

  • Handle system preference gracefully (especially on macOS and Android)


9. Secure Styling in Regulated Environments

Even though CSS isn’t executable, styling misuse can expose security vulnerabilities.

❌ Bad Practice

html
<div class="${userGroup}">Welcome VIP</div>
  • Do not expose sensitive roles in class names

  • Never trust user input when generating classes or inline styles

✅ Secure Patterns

  • Sanitize all dynamic class usage

  • Avoid inline styles unless sanitized

  • Store style tokens server-side if needed for consistent roles


10. Performance Optimization in Large-Scale Apps

In FNB’s context, performance is non-negotiable:

  • Budget: CSS < 100KB uncompressed

  • Lazy load non-critical styles

  • Use dynamic imports:

js
const Dashboard = lazy(() => import('./Dashboard'));
import('./Dashboard.css');

Critical CSS Strategy

Inline only above-the-fold CSS in index.html:

html
<style>
header { background: var(--primary); padding: 1rem; }
</style>

Preload the main stylesheet:

html
<link rel="preload" href="/style/main.css" as="style">

Tree-shake unused classes with:

  • PurgeCSS

  • Vite or Webpack CSS minimizers

  • Tailwind’s content scanner


11. Responsive & Accessible Components

In apps like FNB, users range from 18 to 80+ — and accessibility is a legal requirement.

Dashboard Card Requirements

  • Collapse on small screens

  • Use keyboard navigable buttons

  • Voice-over readable labels (aria-label)

  • High-contrast themes for visually impaired

Secure Input Field

html
<input
type="text"
aria-label="Account Number"
pattern="[0-9]{10}"
inputmode="numeric"
class="input--secure"
/>

Add focus-visible style:

css
.input--secure:focus-visible {
outline: 2px solid var(--fnb-primary);
}

12. Establishing Visual Culture in Teams

In mature product teams, developers aren’t just coders — you’re visual engineers.

Team Guidelines

  • Pair design sign-offs with PR reviews

  • Keep a shared Storybook environment for all styled components

  • Conduct biweekly style retrospectives to review:

    • Token drift

    • Component consistency

    • User feedback on accessibility

  • Document component decisions (Notion, Confluence)


✅ Recap & What To Do Next

You’ve gone far beyond raw CSS syntax. You’re now operating in the real-world:

  • Token-driven design systems

  • Automated testing and linting

  • Figma-to-production pipelines

  • Style security and privacy constraints

  • Enterprise white-label theming

  • Global accessibility coverage

Next Action Items for You

  1. Contribute a real component to the FNB design system (start with a card or input group).

  2. Run a style audit on your last module — find and eliminate dead CSS.

  3. Create a demo dark/light theme switcher with persistent state (localStorage).

  4. Write documentation for any layout or component you own — diagrams welcome.

  5. Improve the CI pipeline to include Stylelint, Percy, or Source Map Explorer.


Final Words

CSS is no longer “just styling.” It’s a product contract. It defines user experience, accessibility, trust, and consistency. In a regulated space like FNB, every pixel matters.

Let your code reflect:

  • Design rigor

  • Performance discipline

  • Security mindfulness

  • Accessibility compassion

  • Engineering elegance

You are now a full-spectrum UI engineer. Welcome to the next level.

Leave a Reply

Your email address will not be published. Required fields are marked *

error: Content is protected !!