@blateral/b.kit 2.0.0-beta.27.0 → 2.0.0-beta.27.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -2,215 +2,92 @@
2
2
 
3
3
  # b.kit - React component library to b.uild awesome websites
4
4
 
5
- The b.kit library consists of a set of essential React components that can be implemented and modified in any React project. The goal is to reduce the need of rebuilding each component every time. Instead they are defined in one library and can be reused in multiple projects.
5
+ The b.kit library consists of a set of essential React components that can be implemented and modified in any React project.
6
+ The goal is to reduce the need of rebuilding each component every time. Instead they are defined, tested and optimized in one library and can be reused in multiple projects.
6
7
 
7
8
  See the up to date [Storybook stories](https://blateral.github.io/b.kit) of each b.kit component.
8
9
 
9
- ## Table of contents
10
+ <br />
10
11
 
11
- - [Usage](#usage)
12
- - [Installation](#installation)
13
- - [Imports](#imports)
14
- - [Theming](#theming)
15
- - [Theme settings](#theme-settings)
16
- - [Colors](#colors)
17
- - [Fonts](#fonts)
18
- - [Using styles](#using-styles)
19
- - [Optional packages](#optional-packages)
20
- - [Carousels](#Carousels)
21
- - [Developement](#developement)
22
- - [Project architecture](#project-architecture)
23
- - [Script commands](#script-commands)
24
- - [Local library testing](#local-library-testing)
12
+ ## Installation
25
13
 
26
- ## Usage
14
+ Run
27
15
 
28
- ### Installation
16
+ ```
17
+ yarn add @blateral/b.kit
18
+ ```
29
19
 
30
- Run `yarn add @blateral/b.kit` to install the component library. Because some packages like React, ReactDom and StyledComponents cannot run on multiple instances they are not included in the library.
20
+ to install the component library. Because some packages like React, ReactDom and StyledComponents cannot run on multiple instances they are not included in the library.
31
21
 
32
22
  > Therefore all peer dependencies must be installed seperately.
33
23
 
34
- ### Imports
24
+ <br />
25
+
26
+ ## Imports
35
27
 
36
28
  The library exports all components as named exports so you can import and use them like:
37
29
 
38
30
  ```jsx
39
- import { ImageCarousel } from '@blateral/b.kit';
31
+ import { Article } from '@blateral/b.kit';
40
32
 
41
- <ImageCarousel
42
- bgMode="full"
43
- onInit={(steps) => console.log(steps)}
44
- images={[...]}
45
- />
33
+ <Article
34
+ title="Lorem ipsum dolor sit amet, consectetuer adipiscing elit."
35
+ superTitle="Cum sociis natoque"
36
+ text="Lorem ipsum dolor sit amet..."
37
+ />;
46
38
  ```
47
39
 
48
- ### Theming
40
+ <br />
41
+
42
+ ## Theming
49
43
 
50
- Each component uses a default set of fallback styles that are bundled within the package. To override this styles the library uses the theme context of styled-components. To use a custom theme the component must be wrapped within the exported library provider. All project specific style overrides can be defined through a Styled-Components `DefaultTheme` object and passed to the provider's `theme` property.
44
+ Each component uses a default set of fallback styles that are bundled within the package. To override this styles the library uses the theme context of styled-components.
45
+ To use a custom theme the component must be wrapped within the exported library provider HOC component. All project specific style overrides can be defined through a
46
+ theme object and passed to the provider's `theme` property.
51
47
 
52
- > Values like `undefined`, `null` or empty string are ignored.
48
+ > Values like `undefined`, `null` or empty strings are ignored.
53
49
 
54
50
  ```jsx
55
- import { ImageCarousel, LibThemeProvider } from '@blateral/b.kit';
51
+ import { Article, LibThemeProvider } from '@blateral/b.kit';
56
52
 
57
53
  const customTheme = {
58
54
  colors: {
59
- mono: {
60
- light: '#ff0000',
55
+ primary: {
56
+ default: '#2B4356',
57
+ hover: '#009FE3',
58
+ inverted: '#ffffff',
59
+ invertedHover: '#009FE3',
61
60
  },
62
61
  },
63
62
  };
64
63
 
65
64
  <LibThemeProvider theme={customTheme}>
66
- <ImageCarousel>...</ImageCarousel>
65
+ <Article
66
+ title="Lorem ipsum dolor sit amet, consectetuer adipiscing elit."
67
+ superTitle="Cum sociis natoque"
68
+ text="Lorem ipsum dolor sit amet..."
69
+ />
67
70
  </LibThemeProvider>;
68
71
  ```
69
72
 
70
- ### Theme settings
71
-
72
- The `DefaultTheme` can be configured by passing a custom theme object to the theme provider. It consists of two parts: `colors` and `fonts`. To override the default b.kit values it is not neccessary to replace all values or subobjects. Just define the values to want to replace and you good to go.
73
-
74
- #### Colors
75
-
76
- Each color is defined in the subobject `colors` of the `DefaultTheme`. In order not to be too specific to a project scenario, they are named with abstract names that do not refer to the actual colors assigned. As example the default b.kit values below:
77
-
78
- ```javascript
79
- {
80
- dark: '#000000',
81
- light: '#ffffff',
82
- mono: {
83
- light: '#F0F0F0',
84
- medium: '#C8C8C8',
85
- dark: '#A5A5A5',
86
- },
87
- primary: {
88
- light: '#DD8AA3',
89
- medium: '#98012E',
90
- dark: '#59011B',
91
- },
92
- secondary: {
93
- light: '#5A7384',
94
- medium: '#35444E',
95
- dark: '#222A30',
96
- },
97
- tertiary: {
98
- light: '#F2F5FA',
99
- medium: '#C9CED7',
100
- dark: '#A8ABB4',
101
- },
102
- };
103
- ```
104
-
105
- #### Fonts
106
-
107
- Font styles are seperated in multiple types like `copy`, `heading`, `super` (super title) and others. Some of them have different forms e.g. `copy-i` for copy italic or `copy-b` for copy bold.
108
-
109
- ```typescript
110
- interface Fonts {
111
- copy: FontOptions;
112
- 'copy-i': FontOptions;
113
- 'copy-b': FontOptions;
114
- super: FontProps;
115
- 'heading-1': FontProps;
116
- 'heading-2': FontProps;
117
- 'heading-3': FontProps;
118
- 'heading-4': FontProps;
119
- label: FontOptions;
120
- callout: FontOptions;
121
- }
122
- ```
123
-
124
- While `FontProps` containing the style props needed for the CSS styling, `FontOptions` are a another way to seperate the font types into different sizes:
125
-
126
- ```typescript
127
- interface FontOptions {
128
- small: FontProps;
129
- medium: FontProps;
130
- big: FontProps;
131
- }
132
- ```
133
-
134
- #### Using styles
135
-
136
- To use the styles that a generated by modifing the `DefaultTheme` context you need the Styled Components theme context reference.
73
+ <br />
137
74
 
138
- Outside of JSX in some of React's functional components:
75
+ ## Connectors
139
76
 
140
- ```typescript
141
- const theme = React.useContext(ThemeContext);
142
- ```
143
-
144
- Inside a Styled Component:
77
+ Connectors are used to connect b.kit components to data coming from a Content Management System (CMS). To date there two
78
+ connector packages available:
145
79
 
146
- ```jsx
147
- color: ${({theme}) => ...};
148
- ```
80
+ - [b.kit MODX](https://www.npmjs.com/package/@blateral/b.kit-modx) `yarn add @blateral/b.kit-modx`
81
+ - [b.kit PRISMIC](https://www.npmjs.com/package/@blateral/b.kit-prismic) `yarn add @blateral/b.kit-prismic` (not maintained anymore. Not compatible with B.KIT 2 versions and version 2 beta releases!)
149
82
 
150
- Then you can use the same functions also used by every b.kit component to get you the right color and font values:
151
-
152
- ```typescript
153
- getColors(theme).dark;
154
- ```
155
-
156
- ```typescript
157
- getFonts(theme).copy.small;
158
- ```
159
-
160
- ### Optional packages
161
-
162
- #### Carousels
163
-
164
- > Some components like the `ImageCarousel` using the external `slick-carousel` and `react-slick` packages. To use them properly its important to install all packages (also listed under peer dependenies) and import the related CSS files.
165
-
166
- As imports (e.g. in Nextjs `_app.tsx`):
167
-
168
- ```jsx
169
- import 'slick-carousel/slick/slick.css';
170
- import 'slick-carousel/slick/slick-theme.css';
171
- ```
172
-
173
- As CDN link (e.g. in Storybook `preview-head.html` or NextJs's `_document.tsx`):
174
-
175
- ```jsx
176
- <link
177
- rel="stylesheet"
178
- type="text/css"
179
- charset="UTF-8"
180
- href="https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.6.0/slick.min.css"
181
- />
182
- <link
183
- rel="stylesheet"
184
- type="text/css"
185
- href="https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.6.0/slick-theme.min.css"
186
- />
187
- ```
188
-
189
- #### Map
190
-
191
- > The Map component is made up with `leaflet`. Therefore the NPM Leaflet package must be installed to properly use all map features.
192
-
193
- To diplaying the map in the right way you should also import the leaflet CSS styles:
194
-
195
- As imports (e.g. in Nextjs `_app.tsx`):
196
-
197
- ```jsx
198
- import 'leaflet/dist/leaflet.css';
199
- ```
200
-
201
- As CDN link (e.g. in Storybook `preview-head.html` or NextJs's `_document.tsx`):
202
-
203
- ```jsx
204
- <link
205
- rel="stylesheet"
206
- href="https://unpkg.com/leaflet@1.6.0/dist/leaflet.css"
207
- />
208
- ```
83
+ <br />
209
84
 
210
85
  # Developement
211
86
 
212
87
  The react component library is compiled with typescript and bundled with [Rollup](https://www.npmjs.com/package/rollup).
213
88
 
89
+ <br />
90
+
214
91
  ## Project architecture
215
92
 
216
93
  The library project is splitted into three pieces.
@@ -219,6 +96,8 @@ The library project is splitted into three pieces.
219
96
  - The Storybook folder `stories`
220
97
  - The build folder `lib` (it contains the bundled library content that is shipped to npm)
221
98
 
99
+ <br />
100
+
222
101
  ## Script commands
223
102
 
224
103
  To build and bundle the library with Rollup into the lib folder enter the script:
@@ -235,10 +114,14 @@ To publish all stories to Github Pages enter:
235
114
 
236
115
  > Before each commit to Github the Husky package takes care of the Storybook stories and deploys them automatically to Github Pages.
237
116
 
117
+ <br />
118
+
238
119
  ## Local Testing
239
120
 
240
121
  The bundled package can be tested locally with a npm package called [Yalc](https://github.com/wclr/yalc). `Yalc` acts as very simple local repository for locally developed packages to share them across a local environment.
241
122
 
123
+ <br />
124
+
242
125
  ### Workflow
243
126
 
244
127
  Install yalc globally: `yarn global add yalc`.
@@ -1 +1 @@
1
- {"version":3,"file":"EventBlock.d.ts","sourceRoot":"","sources":["../../../src/components/blocks/EventBlock.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAkB,MAAM,OAAO,CAAC;AAGvC,OAAY,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAKtC,OAAc,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAa,EAAE,SAAS,EAAE,2BAAmC;AA8E7D,MAAM,WAAW,UAAU;IACvB,iCAAiC;IACjC,IAAI,CAAC,EAAE,QAAQ,EAAE,CAAC;IAElB,qDAAqD;IACrD,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IAEtB,kBAAkB;IAClB,KAAK,CAAC,EAAE,IAAI,CAAC,UAAU,EAAE,YAAY,GAAG,QAAQ,CAAC,CAAC;IAElD,kBAAkB;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,yBAAyB;IACzB,IAAI,CAAC,EAAE,IAAI,CAAC;IAEZ,iCAAiC;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