File Structure

All components are located at client/components and should contain up to four files per component: the component file, a style file, a test file, and a stories file.

Component File

ComponentName.tsx

The component file contains the React component and anything related to the functionality of the component.

This is an example template:

import React from 'react';

import './ComponentName.css';

type ComponentNameProps = {
	/** propName information (shown in Storybook and IDE) */
	propName: PropType;
};

function ComponentName(props: ComponentNameProps) {
	return (

  );
}

export default ComponentName;

There is a preference for hooks and functional components as well as adhering to TypeScript conventions.

Importantly, the component file should follow the React Style Guide

Style File

ComponentName.css

This file can be used to style the React component using standard CSS.

The styling should follow the CSS Style Guide

Test File

ComponentName.test.tsx

The test file contains any unit or snapshot tests that run via Jest.

Each component should have the tests as described in Jest Testing Guide

Stories File

ComponentName.stories.tsx

Each component should have a stories file in order to display in Storybook.