This project is under active development and at the moment provides no useful resources. Internal notes on the project can be seen in the GitLab Wiki.
This project stops short of being a full design system and instead focuses on providing usable components that are informed by the UNDRR brand guidelines and project styles.
These components offer consistency, documentation, and portability to speed up quality development with the expected look and feel. They also help reduce entropy, which is critical to ensuring websites remain accessible.
If there is a Component or Pattern that you need, or you have any other feedback, question, or comment, please contact us in the issue queue.
react-dom
for using the components in other systems. This ensures that the Storybook and other system runtimes remain similar, avoiding issues with React-only components (e.g. react-leaflet
).stories/Components/TypeScriptExampleComponent
)You can use the provided npm scripts to simplify running commands inside Docker containers. These scripts are defined in the package.json
file and can be run using yarn
.
The project uses the following branching strategy:
main
is the primary branch and all commits to it are automatically deployed to the GitHub Pages websitemain
and should reference either:
For production use:
dev
branch is not usedWhen creating a new feature or fix:
main
main
# Start the application: brings up Docker containers, installs dependencies, and runs Storybook locally on port 6006
yarn docker-run
# Install project dependencies inside the Docker container
yarn docker-install
# Build the project for release inside the Docker container
yarn docker-build
# Lint the codebase inside the Docker container
yarn docker-lint
You can use the provided Makefile
to simplify running commands inside Docker containers. Run the following commands to create/update the codebase:
# Start the application, runs Storybook locally via port 6006
make up
# Install project dependencies
make install
# Run Storybook locally
make run
# Lint the codebase
make lint
# Build for release (default mode is production, you can override it with --mode=development)
make build
If you prefer running Docker commands manually, the following commands are available:
# Clone the codebase
git clone git@github.com:unisdr/undrr-mangrove.git
cd undrr-mangrove
# Start the application, runs Storybook locally via port 6006
docker-compose up -d
# Install project dependencies
docker exec -it undrr-mangrove-client-1 bash -c "yarn install"
# Run Storybook locally
docker exec -it undrr-mangrove-client-1 bash -c "yarn run storybook --ci"
# Build the project for release (default mode is production)
docker exec -it undrr-mangrove-client-1 bash -c "yarn run build"
# Lint the codebase
docker exec -it undrr-mangrove-client-1 bash -c "yarn run lint"
When adding new components, we rely on the Jest library to test the library. Jest is a JavaScript testing framework that is easy to use and provides a variety of features for testing React components.
To create tests for your component library, you can create files in the stories/__tests__
folder. Jest will automatically discover and run any files in this folder that end in .test.js
.
Each test file should contain one or more test cases. A test case is a function that takes two arguments: a test description and a callback function. The callback function is where you will write your test code.
The test code should assert that the component behaves as expected. You can use the Jest assertion library to do this. The Jest assertion library provides a variety of functions for asserting different types of values.
To run your tests, you can use the following command:
yarn test
To run the test coverage report, you can use:
yarn test:coverage
We do not yet make the compiled assets available directly; see: https://gitlab.com/undrr/web-backlog/-/issues/545
Provisional assets are available in the dist
directory:
dist/components
: the compiled Storybook components
dist/components/ShareButtons.js
dist/assets
: the compiled static assets ... jpg, css, web fonts, etc.
dist/assets/css/style-preventionweb.css
dist/assets/fonts/mangrove-icon-set/font/mangrove-icon-set.woff2
The base configuration and bootstrapping of this Storybook-powered library was done based off the UNDP Design System, which is MIT licensed, but done with their kind blessing.
Components and code are MIT licensed. The UNDRR look and feel is proprietary.