npm package: @fleet.co/tarmac
Description: Tarmac : Fleet.co Design System
Author: Fleet Team
Latest version: 3.12.0

# Tarmac : Fleet Design System

[![NPM](https://img.shields.io/npm/v/components_library.svg)](https://www.npmjs.com/package/@fleet.co/tarmac) [![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)

<br/><br/>

 <p align="center">
<img height=200 src="./public/images/logo.png"/>
<br/>
  <br/>
Tarmac is fleet.co's Design System. <br/>It is based on create-react-library, styled-components.
  </p>
<br/><br/>

## List of components

- Modal ({Modal})
- Confirmation Modal : yes or no modals ({ConfirmationModal})
- Alert : alert message, mainly used in modals ({Alert})
- Switch/Toggle ({Switch})
- Label ({Label})
- Line : grey line to separate items ({Line})
- Title ({Title})

<br/>
Ongoing development : Button ({Button}), , Input

<br/><br/>

## Install

```bash
npm install @fleet.co/tarmac
```

<br/><br/>

## Use local version in your project

First, make a local copy of this repo and reach to its folder with your IDE.<br/>
Run command

```bash
npm build
```

This will create a dist folder. Reach to it with your IDE and run command

```bash
npm link
```

Now reach to your project's folder and run

```bash
npm link @fleet.co/tarmac
```

In your project's folder, navigate to your node_modules/react folder then

```bash
npm link
```

Go back to the Design System folder and

```bash
npm link react
```

This will create 2 symlinks to use your local DS in your local project.
Now launch your design system and your project

```bash
npm run start
```

<br/><br/>

## Use example

To ease the new components creation, you will find an example project within the Design System itself.<br/>
To launch it, navigate to your DS folder/example and write

```bash
npm run start
```

In the App.js file in the example folder, call your newly created components as described in "Usage" section.

<br/><br/>

## Publish a new version

To publish the new version of your DS to npm, run

```bash
npm run publish-package
```

This will create a new build, patch the current version, publish to npm and push changes to master.<br/>
If everything went smoothly, you will see the following message in your IDE : "Design System successfully updated to X.X.X"
<br/>

Wait for the new version to be released on npm, then go back to your project's folder and install it

```bash
npm i @fleet.co/tarmac
```

<br/><br/>

## Usage

```jsx
import React from 'react'

import { MyComponent } from '@fleet.co/tarmac'

const myPage = () => {
  return <MyComponent />
}
```

<br/><br/>

## Troubleshooting

In case you're facing issue at installing the DS locally, please make sure no process is currently running in both your project and the DS. If so, kill them all and try the "use locally" procedure again.<br/>
You may also have to delete your node_modules folders in both your project and the DS. Then reinstall all packages in both folders and try the "use locally" procedure again.<br/>
If you get an error related to React Hooks after launching your project, it is probably related to the fact you have two different instance of React running in your project and in the DS (ie your symlink didn't work). Kill all process, redo the react symlink and start again.<br/>

<br/><br/>

## License

MIT © [@fleet.co](https://github.com/fleet-co)