All Nunjucks templates from src/templates/modules have been successfully converted to React components!
-
Banner (
Banner.tsx)- Full-width image banner with text overlay
- Responsive font sizing
- Props:
imageSrc,imageAlt,heading
-
Hero (
Hero.tsx)- Responsive hero with picture element
- Different images for mobile/desktop
- Optional link wrapper
- Props:
imageSrc,mobileImageSrc,imageAlt,heading,href
-
Tile (
Tile.tsx)- Square tiles for images or text
- Multiple color variants (grey, pink, etc.)
- Support for CTA links
- Props:
content,variant,ctaLink
-
NavBar (
NavBar.tsx)- Responsive navigation bar
- Logo and navigation links
- Mobile-friendly
- Props:
logoAlt,logoSrc,links
- InfoPanel (
InfoPanel.tsx)- Image background with overlay content
- Label, heading, description, and CTA
- Responsive layout that adapts on mobile
- Props:
imageSrc,label,heading,info,link
-
Pagination (
Pagination.tsx)- Navigation for paginated content
- Previous/Next buttons
- Page indicator (e.g., "2 of 6")
- Optional "back to top" link
- Props:
currentPage,totalPages,onPrevious,onNext,showBackToTop
-
SectionNav (
SectionNav.tsx)- Horizontal navigation for categories/filters
- Active state indicator
- Responsive wrapping
- Props:
links(array with label, href, active)
-
Card (
Card.tsx)- Reusable card for blog posts, products, or general content
- Multiple variants (blog, product, default)
- Image, title, description, and metadata
- Props:
imageSrc,title,description,href,metadata,variant
-
Grid (
Grid.tsx)- Responsive grid container for collections
- Configurable columns (2, 3, or 4)
- Adjustable gap spacing
- Optional heading
- Props:
children,columns,gap,heading
- BrowserUpgrade (
BrowserUpgrade.tsx)
- Warning banner for outdated browsers
- Customizable message and link
- Props:
message,upgradeUrl
Each component follows this structure:
ComponentName/
├── ComponentName.tsx # Main React component
├── ComponentName.types.ts # TypeScript type definitions
├── ComponentName.module.scss # Scoped styles
├── ComponentName.stories.tsx # Storybook stories
└── index.ts # Barrel export
All components use:
- SCSS Modules for scoped styling
- BEM naming convention (preserved from original)
- Responsive breakpoints from
_variables.scss - Design tokens for consistency
Each component has multiple stories demonstrating:
- Default usage
- Different variants/states
- Edge cases
- Prop combinations
{% extends "layout.njk" %}
{% block content %}
<div class="banner">
<img class="banner__image" src="...">
<div class="banner__caption">
<h2 class="banner__heading">Title</h2>
</div>
</div>
{% endblock %}import { Banner } from '@j-cam/pattern-library';
<Banner
imageSrc="..."
heading="Title"
/>These templates were reference/example files and don't need conversion:
html-tags.njk- HTML element examplesindex.njk- Index/home page templatepost.njk- Blog post layout examplepost-collection.njk- Blog listing exampleproduct.njk- E-commerce product page exampleproduct-collection.njk- Product listing exampleproduct-info.njk- Product details partialproduct-options.njk- Product variant selectorproduct-slider.njk- Product image carousel
These can be built by composing the converted components together in your application.
Import and use components:
import {
Banner,
Hero,
Tile,
NavBar,
InfoPanel,
Pagination,
SectionNav,
BrowserUpgrade,
Card,
Grid
} from '@j-cam/pattern-library';
import '@j-cam/pattern-library/styles';
function App() {
return (
<>
<BrowserUpgrade />
<NavBar
logoAlt="Brand"
links={[...]}
/>
<Hero
imageSrc="hero.jpg"
heading="Welcome"
/>
<SectionNav
links={[...]}
/>
<Grid columns={3}>
{items.map(item => (
<Card {...item} variant="blog" />
))}
</Grid>
<InfoPanel
imageSrc="panel.jpg"
heading="Feature"
info="Description..."
link={{ label: 'Learn more', href: '#' }}
/>
<Pagination
currentPage={1}
totalPages={5}
/>
</>
);
}The library includes three example layouts showing how to compose components:
- NavBar + Hero + Tiles (2x2 grid) + Banner + InfoPanel
- Perfect for: Landing pages, marketing sites, portfolios
- NavBar + Hero + SectionNav + Grid of Cards + Pagination
- Perfect for: Blogs, news sites, article listings
- NavBar + Banner + SectionNav + Multiple Grids + InfoPanel
- Perfect for: E-commerce, product catalogs, online stores
See LAYOUTS.md for detailed examples and composition patterns.
- Install dependencies:
npm install - Start Storybook:
npm run dev - Explore components: Browse all components at
http://localhost:6006 - Build library:
npm run buildwhen ready to publish
All components are fully typed, documented, and ready to use!