component-library
Component Library with React components used by the application.
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
Menu
Component Library with React components used by the application.
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
Based on SOC occupation classification
Bump package versions and update CHANGELOG.md so consumers can see what happens between releases. Use when a feature or fix branch is ready.
Pattern Libreary which allows representing graphical components. Provides CSS and uses HTML as a template language. This is where tokens, quarks, atoms, molecules, organisms, templates are defined.
Use when the user wants to pick a GitHub issue to work on from a list. Lists open issues (the ones already assigned to the current user first), lets the user choose one, self-assigns it, creates an isolated workspace, runs setup, clarifies the issue one question at a time, plans (one approval checkpoint), implements, opens a draft PR, and folds every later change — including review feedback — into a single amended commit.
Use when the user wants to clean up stale or merged git worktrees under ~/.workspace (e.g. after PRs are merged and their remote branches deleted). Prunes workspaces whose remote branch is gone. Companion to pick-issue-to-pr.
| name | component-library |
| description | Component Library with React components used by the application. |
Component Library is a part of react folder, you can find it in the react/src folder.
It's a bounded context dedicated to React Components.
The Component Library concept is not especially linked to a technology. The idea is to represent the mechanical part of each component.
It therefore provides React components that will be consumed by another bounded context.
The Component Library consume the Pattern Library, it uses the provided documentation to know classes and structure to use for each component. The CSS is linked using a link tag in the index.html file of the React application.
When implementing a component in the Component Library:
Each component is defined by:
react/src/Ippon<ComponentName>.tsx (PascalCase)react/test/Ippon<ComponentName>.spec.tsxreact/src/index.tsA component file follows this structure:
import type { DataSelectableWithChildren } from './DataSelectable.ts';
import { clsx } from 'clsx';
import { optionalToAlternativeClass } from './CAP.ts';
type IpponComponentProps = DataSelectableWithChildren<{
variant?: 'primary' | 'secondary';
color?: IpponTokenTextColor;
}>;
export const IpponComponent = (props: IpponComponentProps) => (
<div
className={clsx(
'ippon-component',
optionalToAlternativeClass(props.variant),
optionalToAlternativeClass(props.color),
)}
data-selector={props.dataSelector}
>
{props.children}
</div>
);
DataSelectable<T> for components without childrenDataSelectableWithChildren<T> for components with childrendataSelector?: string (via DataSelectable)Tokens.ts for colors and sizes (e.g., IpponTokenTextColor, IpponTokenSize)-variant) as union typesborder or placeholder as optional propsclsx() from the clsx library to conditionally build class namesCAP.ts:
optionalToAlternativeClass(value) → converts 'primary' to '-primary'optionalToPrefixedAlternativeClass(prefix)(value) → converts 'l1' with prefix 'shadow' to '-shadow-l1'toAlternativeClass(value) → always converts to alternative class (non-optional)If the Pattern Library component has parts (CSS classes like ippon-component--part):
IpponComponentPart for parts with significant propsclsx('ippon-component--part', ...) for part class namesExample with slots:
export const IpponVSpaceSlot = (props: IpponVSpaceSlotProps) => (
<div
className={clsx('ippon-v-space--slot', optionalToAlternativeClass(props.align))}
data-selector={props.dataSelector}
>
{props.children}
</div>
);
Add each new component to react/src/index.ts:
export { IpponComponent } from './IpponComponent.tsx';
export { IpponComponentPart } from './IpponComponent.tsx'; // if applicable
Tests are located in react/test/ and use Vitest + Testing Library.
cd react
pnpm test:unit:ci
Each component test should:
dataSelector bindingtag prop)Example test:
import { describe, it, expect, afterEach } from 'vitest';
import { render, screen, configure, cleanup } from '@testing-library/react';
import '@testing-library/jest-dom/vitest';
import { IpponComponent } from '../src';
configure({
testIdAttribute: 'data-selector',
});
describe('IpponComponent', () => {
afterEach(cleanup);
it('should be like pattern library', () => {
render(<IpponComponent dataSelector="ippon-component">Content</IpponComponent>);
const component = screen.getByTestId('ippon-component');
expect(component).toHaveClass('ippon-component');
});
it.each(['primary', 'secondary'] as const)('should have variant %s', (variant) => {
render(<IpponComponent variant={variant} dataSelector="ippon-component" />);
const component = screen.getByTestId('ippon-component');
expect(component).toHaveClass(`-${variant}`);
});
});