x-dash is a monorepo of shared front-end components for FT.com and the FT Apps.
New components should not be added to this monorepo. Existing components continue to be supported and receive new features and bug fixes. In 2024 we will gradually be sunsetting the monorepo and finding new homes for the components and developer tooling.
To get started with x-dash, you'll need to make sure you have the following software tools installed.
Please note that x-dash has only been tested in Mac and Linux environments. If you are on a Mac you may find it easiest to install the Command Line Tools package which includes Git.
To aid the development of interactive components with Storybook it is recommended to install the React Developer Tools for your browser. These addons aid debugging by displaying the rendered component tree and provide access to view and edit their properties:
-
Clone the x-dash Git repository and change to the new directory that has been created:
git clone [email protected]:financial-times/x-dash cd x-dash
-
Install all of the project dependencies (this may take a few minutes if you are running this for the first time):
npm install
-
Build the current set of x-dash components and start Storybook to view:
npm run build npm run start-storybook
The project repository is a monorepo which means all of the tools, packages and components are kept in one place and can be worked upon concurrently.
The repository groups related code together in directories. UI components are stored in the components
directory, documentation files in the docs
directory, additional public packages in the packages
directory.
├ components/
│ └ x-component/
│ ├ readme.md
│ └ package.json
├ packages/
│ └ x-package/
│ ├ readme.md
│ └ package.json
├ readme.md
└ package.json
Storybook is a development environment and showcase for UI components. It makes working on and sharing UI components easier by providing a richly configurable environment.
After installing x-dash you can start Storybook by running the following command from the repository root:
npm run start-storybook
This command will start a server running on local.ft.com:9001 and generate an application presenting all of the components configured to use it. Changes to these components can be updated in real-time speeding up the development process.
Data properties passed to these component may also be configured in-situ and these changes will be reflected in the URL making it possible to share specific configurations.
The best way to ensure you stick to the x-dash code style is to make your work consistent with the code around it. We also provide a Prettier configuration to automatically format files and run ESLint before any tests. See the contribution guide for more information.
For more in-depth information visit the Wiki