<p align="center">
  <img align="center" style="margin: 0 auto"  width="150px"  src="/src/assets/logo/logo.svg" />
</p>

<h1 align="center">
  Aprila Kit
</h1>

> Aprila Kit provides front-end developers & engineers a collection of reusable HTML and CSS partials to build websites and user interfaces. Adopting the library enables developers to use consistent markup, styles, and behavior in prototype and production work.

📚 [Aprila Kit documentation is available here](https://aprilabank-storybook.netlify.com/)

### ⏩ tl;dr

```
npm install
npm start
```

### :neckbeard: Running Aprilakit locally

```
clone this repo
npm install                 # to install dependencies
npm start                   # start local development server
```

[Open http://localhost:6006/](http://localhost:6006/) 🚀

## 📚 Documentation

We use [Storybook](https://storybook.js.org/) to document the design system.

Stories are made using a file format called [MDX](https://mdxjs.com/), and is used to write rich documentation for the components. You will find all the documentation files under the folder `/stories`.

## Guidelines

- All components should do one thing, and do that thing well.
- All CSS should be written to adhere to the BEM methology.
- Don't use Objects or Arrays as props for Web Components. Try to rethink the issue and see if you can make two elements like `select` and `option`. Read more about best practises [here](https://developers.google.com/web/fundamentals/web-components/best-practices)
- New functionality should be reviewed by at least one other person before going into Aprila Kit.

## Contributing

All right, you need to change or add something. What do you do?

1: If the thing you're changing or adding is specific to your project, and not all sites using Aprila Kit, use a separate css file to add or override functionality using your own classes and components.

2: If you're adding new functionality to Aprila Kit, follow the development guide below.

3: If you've found a bug, follow the below "Found a bug?" guide below.

## Development

To develop on the project, please first read our guidelines and the contributing section above.

_To add a new feature:_

- Create a new branch (`git checkout -b branchname`)
- Work on your feature, and commit your changes
- Update the version number in the package.json file. You can read more about versioning below
- Create a pull request into the `development` branch and ask for a review

To modify an existing feature follow the same process, but also remember the versioning system. If there is a breaking change, or if this might impact existing sites using Aprila Kit, update the version number. See below for details.

## Versioning

Aprila Kit uses [semantic versioning](http://semver.org/) to make sure once a site starts using it, the CSS or Web Components won't suddenly change and break the site. The version number is located in `package.json`

When a breaking change is added, a new major version is required.

### Publishing a new version on NPM

The `development` branch works as our `beta` branch, so we can try out new features before we roll them out into production.

_To publish a beta version:_

- Checkout to `development`
- Bump the package.json for example from `0.6.10-beta.9` to `0.6.10-beta.10`
- Run `npm publish --tag beta`

`master` is used as our production branch, so when publishing a new version, make sure you have tested all the new features, and taken into account breaking changes etc.

_To publish to production:_

- Checkout to `master`
- Bump the package.json for example from `0.6.9` to `0.6.10` depending on the types of changes
- Run `npm publish`

## 🔨 Hosting

The documentation is hosted on [Netlify](https://netlify.com). Each time code is pushed to the `master` branch, a new build of the documentation will be deployed. Netlify also creates a unique build per pull request so it's easy for other people to review and see the changes live.

Aprila Kit is published on NPM and can be installed simply by running `npm install --save aprilabank`. If you want to use a CDN, we reccommend that you use [JSDeliver](https://www.jsdelivr.com/).

## ⭐ Adding icons

- Add one or more new svg icons in the `src/assets/icons/` folder
- Run `npm run build:package:svg` to generate SVG sprite.
- Publish a new version on NPM

## 🌐 Browser support

The CSS components should work down to at least IE11. You can make Web Components work down to IE11 with polyfills, but we have not tested Aprila Kit with this in mind. If the application you are building needs to support IE11 we recommend that you only use the CSS components, and implement the dynamic parts yourself. If you don't need IE11 support, go for the Web Components as they are way easier to use, and also update at a later point.

## 📂 Application structure

    ├── /.storybook                 - Storybook config files
    ├── /build                      - Folder that contains the bundled files
    │   ├── /assets                 - Fonts, icons, logo assets
    │   ├── /components             - Individual components for indiviual imports
    │   ├── base.css                - Base styles like font declarations and variables
    │   ├── icons.js                - Javascript snippet that loads the sprite on your page,
    │   ├── main.css                – Main CSS bundle with all components
    │   ├── main.js                 - Main Web Component bundle with all components
    │   └── sprite.svg              - Svg sprite with all icons
    ├── /src
    │   ├── /assets                 - All assets like icons, fonts, logos
    │   ├── /components             - Component files (CSS, and JS)
    │   ├── /styles                 - Global CSS
    │   ├── /utils                  - Helper functions
    │
    ├── /stories                    - Documentation files for Storybook

## Found a bug?

- If you've found a bug, you can create a new [issue](https://github.com/aprilabank/aprilabank/issues) via github.
- If you want to fix this issue yourself, do so and then follow the development guide above.

## 📦 Dependencies

We try to have as few dependencies as possible in Aprila Kit. This makes it easier to maintain in the long run, and it makes it more secure as we are not using some unkown third party code in our projects.

- [LitElement](https://github.com/Polymer/lit-element) - A small web component library
