1.1.6 โ€ข Published 7 days ago

@ntbjs/react-components v1.1.6

Weekly downloads
-
License
UNLICENSED
Repository
bitbucket
Last release
7 days ago

@ntbjs/react-components

This is a library containing NTBs common front-end design utilities and React components.

โœจ Usage

To start using the library is as simple as installing it.

You can then install the library with:

// with NPM  
npm install @ntbjs/react-components  
  
// with Yarn  
yarn add @ntbjs/react-components  

๐Ÿ“š Documentation

@ntbjs/react-components uses Storybook as documentation and playground for all the utilities and components. Storybook will provide the necessary information about how to import and use the components.

โ–ถ Visit our documentation in Storybook

๐Ÿฆบ Development

The library is created with:

Tips before contributing

A component in this library should not assume anything about the context (e.g. layout) it's used in. By assuming the context it may limit the usability and diversity of the component in the consumer application. Therefore, we should strive to make all components layout- and position-agnostic whenever it's possible. Adding margin to a component is best left to the consumer.

All components should use React.forwardRef to let the consumer refer to the component root. They should also accept rest-{...props} in case the consumer needs to assign attributes or event-props to the component root

๐Ÿ“š Storybook

To run a live-reload Storybook server on your local machine:

npm run storybook  

To export your Storybook as static files:

npm run storybook:export  

You can then serve Storybook from the files under storybook-static using S3, GitHub pages, Express or anything that can serve static files.

๐Ÿ–จ๏ธ Generating new components

The project ships with a handy NodeJS utility file under ./util called create-component.js. Instead of copy pasting components to create a new component, you can instead run this command to generate all the files you need to start building out a new component. To use it run:

npm run generate widgets/AmazingComponent
                    โ†‘           โ†‘
                    |           โ””โ”€โ”€โ”€ Component Name
                    โ””โ”€โ”€โ”€ Component Category

This will generate:

โ”€ /src  
  โ””โ”€โ”€ /components
      โ””โ”€โ”€ /widgets
          โ””โ”€โ”€ /AmazingComponent
              โ”œโ”€โ”€ AmazingComponent.js
              โ”œโ”€โ”€ AmazingComponent.stories.js
              โ”œโ”€โ”€ AmazingComponent.styled.js
              โ””โ”€โ”€ index.js

The default templates for each file can be modified under util/templates.

Note: Don't forget to re-export your new component in the index.js-file located in src/components/[component-category]

๐Ÿ”จ Building

You can build the library with:

npm run build  

๐Ÿงช Installing the package locally (for testing only)

Let's say you have another project (test-app) on your machine that you want to try installing the component library into without having to first publish the component library. In the test-app directory, you can run:

npm i --save ../path/to/react-components  

which will install the local component library as a dependency in test-app. It'll then appear as a dependency in package.json like:

"dependencies": {
  ...
  "@ntbjs/react-components": "file:../path/to/react-components",
  ...
}

The library with its utilities and components can then be imported and used in that project.

๐Ÿ“ฆ Publishing

Docs on publishing is coming soon...

๐Ÿ“‚ Application structure

โ”œโ”€โ”€ .storybook                              - The config folder for Storybook  
โ”œโ”€โ”€ /build                                  - Build folder. Contains the output of the build. - auto generated
โ”œโ”€โ”€ /src  
โ”‚   โ”œโ”€โ”€ /components                         - A folder containing all React components  
|   |   โ””โ”€โ”€ /[category]                     - The component category folder  
|   |       โ””โ”€โ”€ /[name]                     - The component folder  
|   |           โ”œโ”€โ”€ [name].js               - The React component code  
|   |           โ”œโ”€โ”€ [name].stories.js       - The Storybook story-definition of the component  
|   |           โ”œโ”€โ”€ [name].styled.js        - The component style powered by styled-components  
|   |           โ””โ”€โ”€ index.js                - A re-export of the component to allow easy ES module imports  
|   |  
โ”‚   โ”œโ”€โ”€ /icons                              - All icons this library provides
|   |   โ””โ”€โ”€ [icon-name].svg  
|   |  
|   โ”œโ”€โ”€ /storybook                          - Storybook documentation thats not liket to a component (like colors / icons)
|   |   โ”œโ”€โ”€ /assets                         - Assets used in the Storybook documentation  
|   |   โ””โ”€โ”€ /mdx                            - Storybook documentation  
|   |  
|   โ”œโ”€โ”€ /styles
|   |   โ”œโ”€โ”€ /utils                          - All SCSS utilities  
|   |   โ”œโ”€โ”€ all.scss                        - A file that imports all utilities and the global config  
|   |   โ””โ”€โ”€ config.scss                     - The global SCSS config  
|   |  
โ”‚   โ””โ”€โ”€ /utils  
โ”‚  
โ”œโ”€โ”€ / package.json                          - Contains all npm scripts  
โ””โ”€โ”€ / *.*                                   - Various dotfiles and config files  
1.2.0-rc.52

7 days ago

1.1.6

7 days ago

1.1.5

8 days ago

1.2.0-rc.50

16 days ago

1.2.0-rc.51

16 days ago

1.1.4

16 days ago

1.2.0-rc.47

30 days ago

1.2.0-rc.48

30 days ago

1.2.0-rc.49

29 days ago

1.1.3

29 days ago

1.2.0-rc.45

1 month ago

1.2.0-rc.46

1 month ago

1.2.0-rc.43

1 month ago

1.2.0-rc.44

1 month ago

1.2.0-rc.42

1 month ago

1.2.0-rc.41

2 months ago

1.2.0-rc.40

2 months ago

1.2.0-rc.38

2 months ago

1.2.0-rc.39

2 months ago

1.2.0-rc.37

2 months ago

1.2.0-rc.36

2 months ago

1.2.0-rc.35

2 months ago

1.2.0-rc.34

2 months ago

1.2.0-rc.33

2 months ago

1.2.0-rc.29

2 months ago

1.2.0-rc.32

2 months ago

1.2.0-rc.30

2 months ago

1.2.0-rc.31

2 months ago

1.2.0-rc.28

2 months ago

1.2.0-rc.25

2 months ago

1.2.0-rc.26

2 months ago

1.2.0-rc.23

2 months ago

1.2.0-rc.27

2 months ago

1.2.0-rc.21

3 months ago

1.2.0-rc.22

3 months ago

1.2.0-rc.20

3 months ago

1.2.0-rc.18

3 months ago

1.2.0-rc.19

3 months ago

1.2.0-rc.17

3 months ago

1.2.0-rc.14

3 months ago

1.2.0-rc.15

3 months ago

1.2.0-rc.12

3 months ago

1.2.0-rc.13

3 months ago

1.2.0-rc.16

3 months ago

1.2.0-rc.11

3 months ago

1.2.0-rc.10

3 months ago

1.2.0-rc.9

3 months ago

1.2.0-rc.8

3 months ago

1.2.0-rc.7

3 months ago

1.1.2

3 months ago

1.2.0-rc.6

3 months ago

1.2.0-rc.5

3 months ago

1.2.0-rc.2

3 months ago

1.2.0-rc.4

3 months ago

1.2.0-rc.3

3 months ago

1.2.0-rc.1

3 months ago

1.1.1

3 months ago

1.1.0-beta.98

3 months ago

1.1.0-beta.94

3 months ago

1.1.0-beta.95

3 months ago

1.1.0-beta.92

3 months ago

1.1.0-beta.93

3 months ago

1.1.0-beta.96

3 months ago

1.1.0-beta.97

3 months ago

1.1.0-beta.91

3 months ago

1.1.0-beta.90

4 months ago

1.1.0-beta.87

4 months ago

1.1.0-beta.88

4 months ago

1.1.0-beta.89

4 months ago

1.1.0-beta.86

4 months ago

1.1.0-beta.84

4 months ago

1.1.0-beta.85

4 months ago

1.1.0-beta.83

4 months ago

1.1.0-beta.82

4 months ago

1.1.0-beta.80

4 months ago

1.1.0-beta.81

4 months ago

1.1.0-beta.78

5 months ago

1.1.0-beta.79

5 months ago

1.1.0-beta.69

5 months ago

1.1.0-beta.68

5 months ago

1.1.0-beta.72

5 months ago

1.1.0-beta.73

5 months ago

1.1.0-beta.70

5 months ago

1.1.0-beta.71

5 months ago

1.1.0-beta.76

5 months ago

1.1.0-beta.77

5 months ago

1.1.0-beta.74

5 months ago

1.1.0-beta.75

5 months ago

1.1.0-beta.65

5 months ago

1.1.0-beta.66

5 months ago

1.1.0-beta.64

5 months ago

1.1.0-beta.67

5 months ago

1.1.0-beta.63

5 months ago

1.1.0-beta.62

5 months ago

1.1.0-beta.61

5 months ago

1.1.0-beta.60

5 months ago

1.1.0-beta.59

5 months ago

1.1.0-beta.10

7 months ago

1.1.0-beta.11

7 months ago

1.1.0-beta.14

7 months ago

1.1.0-beta.15

7 months ago

1.1.0-beta.12

7 months ago

1.1.0-beta.13

7 months ago

1.1.0-beta.18

7 months ago

1.1.0-beta.19

7 months ago

1.1.0-beta.16

7 months ago

1.1.0-beta.17

7 months ago

1.1.0-beta.9

7 months ago

1.1.0-beta.8

8 months ago

1.1.0-beta.7

8 months ago

1.1.0-beta.2

8 months ago

1.1.0-beta.21

7 months ago

1.1.0-beta.6

8 months ago

1.1.0-beta.22

7 months ago

1.1.0-beta.5

8 months ago

1.1.0-beta.4

8 months ago

1.1.0-beta.20

7 months ago

1.1.0-beta.3

8 months ago

1.1.0-beta.25

7 months ago

1.1.0-beta.26

7 months ago

1.1.0-beta.23

7 months ago

1.1.0-beta.24

7 months ago

1.1.0-beta.29

7 months ago

1.1.0-beta.27

7 months ago

1.1.0-beta.28

7 months ago

1.1.0-beta.32

7 months ago

1.1.0-beta.33

7 months ago

1.1.0-beta.30

7 months ago

1.1.0-beta.31

7 months ago

1.1.0-beta.36

7 months ago

1.1.0-beta.37

6 months ago

1.1.0-beta.34

7 months ago

1.1.0-beta.35

7 months ago

1.1.0-beta.38

6 months ago

1.1.0-beta.39

6 months ago

1.1.0-beta.40

6 months ago

1.1.0-beta.43

6 months ago

1.1.0-beta.44

6 months ago

1.1.0-beta.41

6 months ago

1.1.0-beta.42

6 months ago

1.1.0-beta.47

6 months ago

1.1.0-beta.48

6 months ago

1.1.0-beta.45

6 months ago

1.1.0-beta.46

6 months ago

1.1.0-beta.49

5 months ago

1.1.0-beta.50

5 months ago

1.1.0-beta.51

5 months ago

1.1.0-beta.54

5 months ago

1.1.0-beta.55

5 months ago

1.1.0-beta.52

5 months ago

1.1.0-beta.53

5 months ago

1.1.0-beta.58

5 months ago

1.1.0-beta.56

5 months ago

1.1.0-beta.57

5 months ago

1.1.0-beta.1

10 months ago

1.0.0

11 months ago

0.0.1-beta.50.1

12 months ago

0.0.1-beta.50.2

12 months ago

0.0.1-beta.50

12 months ago

0.0.1-beta.47

1 year ago

0.0.1-beta.46

1 year ago

0.0.1-beta.49

1 year ago

0.0.1-beta.48

1 year ago

0.0.1-beta.45

1 year ago

0.0.1-beta.44

2 years ago

0.0.1-beta.43

2 years ago

0.0.1-beta.42

2 years ago

0.0.1-beta.41

2 years ago

0.0.1-beta.40

2 years ago

0.0.1-beta.39

2 years ago

0.0.1-beta.36

2 years ago

0.0.1-beta.38

2 years ago

0.0.1-beta.37

2 years ago

0.0.1-beta.32

2 years ago

0.0.1-beta.34

2 years ago

0.0.1-beta.33

2 years ago

0.0.1-beta.35

2 years ago

0.0.1-beta.31

3 years ago

0.0.1-beta.30

3 years ago

0.0.1-beta.23

3 years ago

0.0.1-beta.29

3 years ago

0.0.1-beta.28

3 years ago

0.0.1-beta.25

3 years ago

0.0.1-beta.24

3 years ago

0.0.1-beta.27

3 years ago

0.0.1-beta.26

3 years ago

0.0.1-beta.21

3 years ago

0.0.1-beta.22

3 years ago

0.0.1-beta.20

3 years ago

0.0.0

3 years ago

0.0.1-beta.19

3 years ago

0.0.1-beta.18

3 years ago

0.0.1-beta.17

3 years ago

0.0.1-beta.16

3 years ago

0.0.1-beta.15

3 years ago

0.0.1-beta.14

3 years ago

0.0.1-beta.13

3 years ago

0.0.1-beta.12

3 years ago

0.0.1-beta.11

3 years ago

0.0.1-beta.10

3 years ago

0.0.1-beta.9

3 years ago

0.0.1-beta.7

3 years ago

0.0.1-beta.6

3 years ago

0.0.1-beta.8

3 years ago

0.0.1-beta.3

3 years ago

0.0.1-beta.5

3 years ago

0.0.1-beta.4

3 years ago

0.0.1-beta.2

3 years ago

0.0.1-beta.1

3 years ago

0.0.1-alpha.17

3 years ago

0.0.1-alpha.16

3 years ago

0.0.1-alpha.15

3 years ago

0.0.1-alpha.14

3 years ago

0.0.1-alpha.13

3 years ago

0.0.1-alpha.12

3 years ago

0.0.1-alpha.11

3 years ago

0.0.1-alpha.10

3 years ago

0.0.1-alpha.9

3 years ago

0.0.1-alpha.8

3 years ago

0.0.1-alpha.7

3 years ago

0.0.1-alpha.6

3 years ago

0.0.1-alpha.5

3 years ago

0.0.1-alpha.4

3 years ago

0.0.1-alpha.3

3 years ago

0.0.1-alpha.2

3 years ago

0.0.1-alpha.1

3 years ago