# Installation

Using npm:

```shell
$ npm install @axos-web-dev/shared-components
```

To import components
In Node.js:

```js
// Import Components
import {
  AlertBanner,
  CallToActionBar,
  DownloadTile,
  ImageBillboard,
  SecondaryFooter,
} from "@axos-web-dev/shared-components";

// Import Types/Interfaces

import { AlertBannerInterface } from "@axos-web-dev/shared-components/dist/AlertBanner/AlertBanner.interface";
```

In css files:

```css
/*** Import styles ***/

@import "@axos-web-dev/shared-components/dist/assets/AlertBanner/AlertBanner.css";
```

# Shared components

This project is develop using `React + TypeScript + Vite + Storybook + Vanilla-extract` to building custom components for internal use.

## How to add new component

For add a new component use the `src/lib` folder and create a folder for the component. After that you should register an export in `src/lib/main.ts` file.

Also you need create a storie for the new component. Go to `src/stories` and create a new file or folder.

```shell
git clone bofaz@vs-ssh.visualstudio.com:v3/bofaz/Axos%20Marketing%20Cloud/Shared%20Components shared-components

cd shared-components

npm install

# for using storybook
npm run storybook

# for build
npm run build

# for testing in other projects
npm run build

npm link

```

For publishing we need to udpate the version we are using [semantic versioning](https://semver.org/)

```
Given a version number MAJOR.MINOR.PATCH, increment the:

    MAJOR version when you make incompatible API changes
    MINOR version when you add functionality in a backward compatible manner
    PATCH version when you make backward compatible bug fixes

Additional labels for pre-release and build metadata are available as extensions to the MAJOR.MINOR.PATCH format.
```

we can update the version with the following commands:

```shell
# bumps the patch number like 0.0.0 -> 0.0.1
npm version patch

# bumps the patch number like 0.0.0 -> 0.1.0
npm version minor

# bumps the patch number like 0.0.0 -> 1.0.0
npm version major



```

## How to publish new library version to npm

First update the version as previously described

```shell
npm version [...]
```

Then you will need to login into npm to do that write:

```shell
npm login --scope=@my-org
```

Last you to publish the new version:

```shell
npm publish
```
