Hello TractorConsole prototype
Demo data

About Atomic Design

Shared components let Hello Tractor reuse interface patterns across its web platforms while tailoring access, features, and themes to each audience.

Page → Template → Tractor Details → Notes Editor → Save Note button

Design for reuse across products

The learning management system (LMS) and Tractor Owner (TO) web app can share buttons, field composition, helper text, validation, and the navigation shell. The LMS can supply training content while TO supplies tractor records. Build recurring interaction and accessibility patterns early so both products can use them as requirements emerge.

Documenting every theoretical scenario upfront can waste time if business priorities shift. Start by documenting core Atoms and Molecules thoroughly, and build Organism/Page scenarios incrementally as product requirements solidify.

This demo’s sidebar uses a fixed-width navigation column beside a flexible main column on desktop. On phones the navigation reflows above the content, and the demo controls follow it below the main area.

Open a level to try the component and read the code. Component Story Format (CSF) uses the default export for component metadata, default args and Docs descriptions. Named exports define individual scenarios. Play functions simulate interactions in the story.

Brad Frost’s Atomic Design methodology

The button exposes disabled and onClick. Its text supplies the accessible name. Hover uses primary.dark and common.white. Tab shows a focus ring using text.primary. Enter and Space activate it.

Activations: 0

Button.stories.tsx · CSF excerpt

import type { Meta, StoryObj } from '@storybook/react-vite';
import { fn } from 'storybook/test';
import { SaveNoteButton } from './components';

const meta = {
  title: 'Atomic Design/Atom/Button',
  component: SaveNoteButton,
  args: { disabled: false, onClick: fn() },
} satisfies Meta<typeof SaveNoteButton>;
export default meta;

type Story = StoryObj<typeof meta>;
export const Default: Story = {};
export const Disabled: Story = { args: { disabled: true } };

Test code

// Button.stories.tsx · keyboard interaction
export const KeyboardFocus: Story = {
  play: async ({ canvas, userEvent, args }) => {
    const button = canvas.getByRole('button', { name: 'Save note' });
    await userEvent.tab();
    await expect(button).toHaveFocus();
    await userEvent.keyboard('{Enter}');
    await expect(args.onClick).toHaveBeenCalled();
  },
};
Open Save Note button Docs in Storybook

This molecule combines a labeled field, helper or validation text, and the Save Note atom. Clear the field to see the linked error. Type a valid change to enable Save. Storybook also shows read-only and unavailable states.

Field notes

Include the nearest landmark for the next operator.

components.tsx · Notes Editor excerpt

<TextField
  id={inputId}
  label="Note"
  error={!!error}
  helperText={error || helperText}
/>
<SaveNoteButton
  disabled={!!error || !trimmed || trimmed === value}
  onClick={() => onSave(trimmed)}
/>

Test code

// NotesEditor.stories.tsx · validation and accessibility
export const ValidationError: Story = {
  play: async ({ canvas, userEvent }) => {
    const field = canvas.getByRole('textbox', { name: 'Note' });
    await userEvent.clear(field);
    await expect(field).toHaveAttribute('aria-invalid', 'true');
    await expect(field).toHaveAccessibleDescription('Enter a note before saving.');
    await expect(canvas.getByRole('button', { name: 'Save note' })).toBeDisabled();
  },
};
Open Notes Editor Docs in Storybook

The panel combines the Status Badge atom, tractor context, and the Notes Editor molecule. Try Narrow preview to stack cards and Show notes to see how the cards change height. The same preview mixes inside, overlap, and outside tractors with editable, read-only, and hidden notes.

Tractor details

Thika 01

HT-1042 · DEMO 042

Inside

Thika North

Assigned territory · Thika NorthOperator · Grace Wanjiku-1.105° lat · 37.091° lon

Field notes

160 characters maximum.

Tractor details

Thika 04

HT-1168 · DEMO 168 · Archived

Overlap

Thika North / Juja East

Assigned territory · Thika NorthOperator · Mercy Chebet-1.129° lat · 37.150° lon

Field notes

Archived tractor.
Tractor details

Juja 03

HT-2086 · DEMO 086

Outside

Outside mapped territories

Assigned territory · Juja EastOperator · Brian Otieno-1.197° lat · 37.191° lon

Tractor Details · composition and CSF excerpts

// Inside TractorDetails, using props supplied by the workflow
<StatusBadge status={statusOf(tractor)} />
<NotesEditor {...notes} />

// In TractorDetails.stories.tsx
export const ResponsiveCombinations: Story = {
  render: () => <DetailsDemo />,
};

Test code

// Chrome smoke check · mixed-state details preview
const row = page.locator('.details-demo');
assert.equal(await row.locator('.details-card').count(), 3);

await page.getByRole('checkbox', { name: 'Narrow preview' }).click();
assert.ok((await row.boundingBox()).width <= 301);

await page.getByRole('checkbox', { name: 'Show notes' }).click();
assert.equal(await row.getByRole('region', { name: 'Notes' }).count(), 0);
Open Tractor Details Docs in Storybook

WorkspaceTemplate arranges slots. The geofence workflow supplies a map and results. Tractor Activity fills the same layout with an event list.

Map
Tractor results
Tractor details

Thika 01

HT-1042 · DEMO 042

Inside

Thika North

Assigned territory · Thika NorthOperator · Grace Wanjiku-1.105° lat · 37.091° lon

Field notes

160 characters maximum.

Workflow.tsx · template usage

<WorkspaceTemplate
  map={<TerritoryMap {...mapProps} />}
  results={<TractorResults {...resultProps} />}
  details={<DetailInstances {...props} />}
/>
Open Workspace layout Docs in Storybook

The running workspace fills the template with realistic Kenyan demo records, selection, and resolved access. The live route also connects its filters to the URL.

Hub Geofence

Monitor tractor locations and territory activity.

Territory map

Kiambu County, Kenya · Synthetic boundaries

● Offline map
Thika NorthJuja EastRuiru SouthHT-1042HT-2086HT-1168
Inside
Outside
Overlap

Tractors

3 visible · Demo records

TractorTerritoryStatus
HT-1042Thika North
Inside
HT-2086Juja East
Outside
HT-1168Thika North
Overlap
Tractor details

Thika 01

HT-1042 · DEMO 042

Inside

Thika North

Assigned territory · Thika NorthOperator · Grace Wanjiku-1.105° lat · 37.091° lon

Field notes

160 characters maximum.

Notes Edit grant is active and the inline editor is enabled.

pages/geofence.tsx · route composition

const { workflow } = useDemoWorkflow();
return <GeofencePage {...workflow} filters={filters} />;
Open the Geofence page story