Skip to content

egargan-ft/origami

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Origami Component System

Welcome to Origami!

This is the repository for the Origami components, libraries, and apps that make up the Origami Component System.

Proposals

If you'd like to make a proposal for a new component or anything else, go ahead and open an issue.

Projects in this repository

This repository houses many projects of different kinds. Most of them have READMEs of their own where you can learn more about them.

apps/website

The Origami website, served at https://origami.ft.com.

apps/storybook

Origami's storybook, served at https://origami.ft.com/storybook/.

components and libraries

Components and libraries that implement the FT's design system for the web.

presets

Presets for development tools that make it easier to build consistent components.

scripts

Scripts for maintenance of the repository itself

scripts/components

Default scripts used in component package.jsons for building and testing components.

tools

Tools used to build and test Origami components

Running Origami locally

Requirements

There is some software you'll need on your computer in order to work with this repo.

volta

We use volta to make sure everyone is using the same versions of node and npm.

curl https://get.volta.sh | bash

git-lfs

To keep the repo speedy, we use git-lfs to store binary files like the images on the website.

brew install git-lfs
git lfs install

entr

entr is used in the component watch command for watching files

brew install entr

rg

ripgrep is used in the component watch command for quickly choosing the files to watch for changes.

brew install rg

Quick start

  1. First, clone the repo

    git clone [email protected]:Financial-Times/origami.git
    cd origami
  2. Then npm install. This will install all the components into the root node_modules, allows all the components to find one another.

    npm install
  3. Run the storybook. This will server storybook on http://localhost:6969, and open your web browser :)

    npm run storybook

Developing components

Setup

Follow the quick start guide to get started developing components.

Preview demos

Registry

Components that have not yet been migrated to Storybook still have their old demos as shown in the registry. You can view these using the build and start commands.

npm run build -w components/o-example
npm run start -w components/o-example

This will generate demos for all brands that the component is configured to be a part of.

Watch demos

To serve the demos, and have them automatically rebuild when the code changes you can use the watch command.

npm run watch -w components/o-example
Storybook

Storybook can be run locally with the storybook command.

npm run storybook

To view components in other brands in Storybook, set the ORIGAMI_STORYBOOK_BRAND environment variable with the brand.

ORIGAMI_STORYBOOK_BRAND=internal npm run storybook

Setting brands

Some components you create may only be part of one brand. We recommend you follow these guidelines when contributing branded components:

Registry

Origami Registry component demos are branded through the origami.json manifest in the component's root directory. You can find how to use this file in the Origami documentation.

Storybook

Storybook component demos can be branded by introducing a brand sub-directory within the stories folder, and placing brand-specific stories within it. e.g:

o-labels/
    demos/
    src/
    stories/
       core/
           // Core brand stories go in this directory.
           labels.stories.tsx
           labels.scss
       //Unbranded stories can be placed in the root of stories/
       labels.stories.tsx
       labels.scss

o-labels provides a good example of this.

Test

Run tests for a given component with the npm test script.

npm run test -w components/o-example

Run JavaScript tests in a browser using the debug:js script.

npm run debug:js -w components/o-example

Lint the code of a given component with the npm lint script.

npm run lint -w components/o-example

Tips

  • If you're working on the storybook configuration and it starts acting weird and not working, try running it without the cache: npm run storybook -- --no-manager-cache

Contributing

If you want to contribute, check out CONTRIBUTING.md.

About

The Origami Component System

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 35.0%
  • Mustache 27.2%
  • SCSS 20.7%
  • TypeScript 8.4%
  • HTML 7.7%
  • CSS 0.7%
  • Other 0.3%