0.6.49 • Published 1 year ago

@47nordmedia/k2-systems-ui-library v0.6.49

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

K2 Systems library

Publish to NPM

Description

This library is used as a single source for UI elements throughout the K2 Systems' digital services.

Setup

Prerequisites

  • Tailwind.css >= 3

Add package

npm install --save @47nordmedia/k2-systems-ui-library

or

yarn add @47nordmedia/k2-systems-ui-library

tailwind.config.js

Add the config file of the ui-library to your tailwind.config.js

module.exports = {
  presets: [require('@47nordmedia/k2-systems-ui-library/dist/tailwind.config.js')],
  // config specific to this project would go here
  // ...
};

HTML / PHP

Add the custom classes to your existing css files.

@import 'tailwindcss/base';
@import '@47nordmedia/k2-systems-ui-library/dist/customBase.css';

@import 'tailwindcss/components';
@import '@47nordmedia/k2-systems-ui-library/dist/customComponents.css';
@import '@47nordmedia/k2-systems-ui-library/dist/main.css';

@import 'tailwindcss/utilities';
@import '@47nordmedia/k2-systems-ui-library/dist/customUtilities.css';

HTML / PHP LEGACY Styles

To use the legacy styles (pre web-components) use the following snippet to add the styles to your project.

@import 'tailwindcss/base';
@import '@47nordmedia/k2-systems-ui-library/dist/customBase.css';

@import 'tailwindcss/components';
@import '@47nordmedia/k2-systems-ui-library/dist/customComponents.css';
@import '@47nordmedia/k2-systems-ui-library/dist/main.css';

@import 'tailwindcss/utilities';
@import '@47nordmedia/k2-systems-ui-library/dist/customUtilities.css';

@import '@47nordmedia/k2-systems-ui-library/dist/legacyStyles.css';

Usage

Style-Guide

use npx serve dist -l 8081 to see the style-guide in the browser.

Icon Library

ICON LIBRARY

Example (HTML, PHP)

<div class="button ...">Hello World!</div>

JS Framework

todo ...

Example (react.js)

import uiClasses from '@47nordmedia/k2-systems-ui-library';

export default function Button() {
  return <div className={`${uiClasses.button} ...`}>Hello World!</div>;
}

Workflow for adding new components

  • Open new issue via 'new ui component' template.
  • Set the issue to 'approved' once its tested and reviewed.
  • Open new pull request and link the created issue.
  • Merge pull request to main.
  • Check build workflow for potential errors.
  • Update ui library in you project to latest version.

Multiple issues for nested components

  • to do...

Examples

To structure nested related components we use an adapted BEM naming convention. The CSS part will be the standard BEM convention.

The JS part however will replace the dash-case naming convention and replace it with the camelCase naming convention.

All the CSS classes will be generated out of the JavaScript files. Below you can see how the classnames are being converted.

navMenu (js) --> nav-menu (css)
navMenu__item (js) --> nav-menu__item (css)
<nav class="nav-menu">
  <li class="nav-menu__item"></li>
  <li class="nav-menu__item"></li>
  <li class="nav-menu__item active"></li>
</nav>
// navMenu.ts
export default 'flex align-center justify-between';

// navMenu__item.ts
export default 'p-2 bg-gray-100 rounded-xl hover:bg-gray-200';

// index.ts
import navMenu from './classes/navMenu';
import navMenu__item from './classes/navMenu__item';

export default {
  navMenu: navMenu,
  navMenu__item: navMenu__item,
};

CLI Interface & CI/CD usage

CLI

To add a new class to the classes list, simply run:

yarn run build:js -c '<new-class-name>' -l '<tailwind classes>'

e.g.

yarn run build:js -c 'button' -l 'bg-gray-100 rounded-xl hover:bg-gray-200'

To generate a corresponding CSS file run:

yarn run build:css

CI/CD

fully automated process coming soon...

  • Creation of a new branch based on the component name.
  • Fetching of the ui-component issue content.
  • Execution of the CLI with the content of the issue.
  • Creation of an pull request.
  • Publishing the updated code to a private NPM package.
0.6.47

1 year ago

0.6.49

1 year ago

0.6.48

1 year ago

0.6.21

1 year ago

0.6.20

1 year ago

0.6.23

1 year ago

0.6.22

1 year ago

0.6.29

1 year ago

0.6.28

1 year ago

0.6.25

1 year ago

0.6.24

1 year ago

0.6.27

1 year ago

0.6.26

1 year ago

0.6.12

2 years ago

0.6.11

2 years ago

0.6.18

1 year ago

0.6.17

1 year ago

0.6.19

1 year ago

0.6.14

1 year ago

0.6.13

1 year ago

0.6.16

1 year ago

0.6.15

1 year ago

0.6.43

1 year ago

0.6.42

1 year ago

0.6.45

1 year ago

0.6.44

1 year ago

0.6.41

1 year ago

0.6.40

1 year ago

0.6.46

1 year ago

0.6.32

1 year ago

0.6.31

1 year ago

0.6.34

1 year ago

0.6.33

1 year ago

0.6.30

1 year ago

0.6.39

1 year ago

0.6.36

1 year ago

0.6.35

1 year ago

0.6.38

1 year ago

0.6.37

1 year ago

0.6.10

2 years ago

0.6.7

2 years ago

0.6.6

2 years ago

0.6.9

2 years ago

0.6.8

2 years ago

0.6.3

2 years ago

0.6.2

2 years ago

0.6.5

2 years ago

0.6.4

2 years ago

0.6.1

2 years ago

0.6.0

2 years ago

0.5.10

2 years ago

0.5.11

2 years ago

0.5.8

2 years ago

0.5.9

2 years ago

0.5.12

2 years ago

0.4.9

2 years ago

0.5.7

2 years ago

0.4.8

2 years ago

0.4.10

2 years ago

0.4.13

2 years ago

0.4.14

2 years ago

0.4.11

2 years ago

0.4.12

2 years ago

0.5.4

2 years ago

0.5.3

2 years ago

0.5.6

2 years ago

0.5.5

2 years ago

0.5.0

2 years ago

0.5.2

2 years ago

0.5.1

2 years ago

0.4.5

2 years ago

0.4.7

2 years ago

0.4.6

2 years ago

0.4.4

2 years ago

0.4.3

2 years ago

0.4.2

2 years ago

0.4.1

2 years ago

0.4.0

2 years ago

0.3.9

2 years ago

0.3.8

2 years ago

0.3.6

2 years ago

0.3.4

2 years ago

0.3.3

2 years ago

0.3.2

2 years ago

0.3.1

2 years ago

0.3.0

2 years ago

0.2.0

2 years ago

0.1.5

2 years ago

0.1.4

2 years ago

0.1.3

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago