Skip to content

Commit 4fa7b14

Browse files
authored
Merge pull request #152 from skilld-labs/kaizen-updates
Kaizen updates
2 parents 84cc401 + d19a219 commit 4fa7b14

File tree

11 files changed

+57
-42
lines changed

11 files changed

+57
-42
lines changed

packages/kaizen-breakpoints/README.md

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,24 +9,29 @@
99

1010
## What is this?
1111

12-
- This package contains some script which parses breakpoints from themename/themename.breakpoints.yml and adds them into css and javascript.
12+
- This package contains some script which parses breakpoints from Drupal's themename/themename.breakpoints.yml and adds them into css and javascript.
1313

1414
## Usage
1515

16-
1. This package is added as a dependency for [@skilld/kaizen-tg](https://www.npmjs.com/package/@skilld/kaizen-tg) package, so normally once theme is installed - you have `kaizen-breakpoints` already under the hood.
17-
2. To see the list of all available breakpoints and its names which you can use in your css and js files - you can run storybook and find it here `/?path=/story/globals-variables--breakpoints` (It is Globals / Variables / Breakpoints) path in storybook
18-
3. Syntax of usage in css files (`@db` btw means `drupal breakpoint`):
16+
Once [kaizen-tg](https://www.npmjs.com/package/@skilld/kaizen-tg) is installed:
17+
1. To see the list of all available breakpoints and its names which you can use in your css and js files - you can run storybook and find it here `/?path=/story/globals-variables--breakpoints` (It is Globals / Variables / Breakpoints path in storybook)
18+
2. Syntax of usage in css files (`@db` btw means `drupal breakpoint`):
1919
- `@db l {}` <-- it is analogue of old `@drupal-breakpoint l_1x {}` we had in Kaizen v1
2020
- `@db l_1x {}`
21-
- `@db l_2x {}` <-- this is 2x multiplier for retina screens. We don't use usually it in css files, but this breakpoint needed for Drupal's responsive image groups, for 2x increased image styles.
22-
4. Syntax of usage in js files:
21+
- `@db l_2x {}` <-- this is 2x multiplier for retina screens. We don't use usually it in css files, but this breakpoint needed for Drupal's responsive image groups, for 2x increased image styles
22+
3. Syntax of usage in js files:
2323
- all breakpoints located in `window.themeBreakpoints.themeName`
2424

2525
## Recommendations
2626

27-
5. Modern example of checking if screen's width now matches one or another breakpoint:
27+
1. Modern example of checking if screen's width now matches one or another breakpoint:
2828
- `if (window.matchMedia(window.themeBreakpoints.themeName.breakpointName).matches) {}`
2929

30+
## Other kaizen's packages
31+
1. [kaizen-tg](https://www.npmjs.com/package/@skilld/kaizen-tg)
32+
2. [kaizen-cg](https://www.npmjs.com/package/@skilld/kaizen-cg)
33+
3. [kaizen-core](https://www.npmjs.com/package/@skilld/kaizen-core)
34+
3035
# License
3136

3237
This project is licensed under the MIT open source license.

packages/kaizen-breakpoints/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@skilld/kaizen-breakpoints",
3-
"version": "2.0.0-alpha.2",
3+
"version": "2.0.0-alpha.3",
44
"description": "Breakpoints YML to css and js",
55
"repository": {
66
"type": "git",

packages/kaizen-cg/README.md

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,23 +9,24 @@
99

1010
## What is this?
1111

12-
- This is a component generator for kaizen
12+
- This is a component generator for [kaizen-tg](https://www.npmjs.com/package/@skilld/kaizen-tg)
1313

1414
## Usage
1515

16-
1. `cd web/themes/custom/themename`
17-
2. `yarn cc` and follow instructions.
16+
Once [kaizen-tg](https://www.npmjs.com/package/@skilld/kaizen-tg) is installed, use:
17+
1. `cd [themename_dir]`
18+
2. `yarn cc` and follow instructions
1819

1920
## Recommendations
2021

21-
1. Please follow BEM methodology when you creating component. More about BEM's namings http://getbem.com/naming/
22-
2. Avoid jQuery inside of component as much as possible. Try to not use external libraries with jQuery dependency. Here is a useful link how to make one or another thing without jquery on vanilla javascript https://github.com/nefe/You-Dont-Need-jQuery
23-
3. Don't worry now about IE11 browser. Kaizen doesn't support it
24-
4. Use argTypes as much as possible (if your component is not static and have different modifiers), try to avoid component's variations if it's possible to replace them by argTypes.
25-
5. Don't hardcode content in `component-name.twig` or `component-name.stories.js` of the component, you should build re-usable components. All default content should be added into `component-name.json` file, and then this content can be modified using `args` from any other component.
22+
1. Please follow BEM methodology when you are creating component. More about BEM's namings [here](http://getbem.com/naming/)
23+
2. Avoid jQuery inside of component as much as possible. Try to not use external libraries with jQuery dependency. Here is a useful [link](https://github.com/nefe/You-Dont-Need-jQuery) how to make one or another thing without jQuery on vanilla javascript
24+
3. Don't worry now about IE11 browser - [kaizen-tg](https://www.npmjs.com/package/@skilld/kaizen-tg) doesn't support it
25+
4. Use [argTypes](https://storybook.js.org/docs/react/api/argtypes) as much as possible if your component is not static and have different modifiers, try to avoid a lot of component's variations if it's possible to replace them by argTypes
26+
5. Don't hardcode content in `component-name.twig` or `component-name.stories.js` of the component, you should build re-usable components. All default content should be stored into `component-name.json` file, and then this content can be modified using `args` from any other component.
2627

2728
## Other kaizen's packages
28-
1. [kaizen-cg](https://www.npmjs.com/package/@skilld/kaizen-cg)
29+
1. [kaizen-tg](https://www.npmjs.com/package/@skilld/kaizen-tg)
2930
2. [kaizen-core](https://www.npmjs.com/package/@skilld/kaizen-core)
3031
3. [kaizen-breakpoints](https://www.npmjs.com/package/@skilld/kaizen-breakpoints)
3132

packages/kaizen-cg/_templates/component/new/component.stories.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,15 @@ export const basic = (args = {}) => {
3434
attributes.setAttribute(attrName, attrValue);
3535
}
3636
}
37+
38+
delete args.attributes;
3739
}
3840
data.attributes = attributes;
3941
useEffect(() => {
4042
<%= h.inflection.camelize(name.replace(/ /g, '').replace(/-/g, '_'), true) %>();
4143
}, [args]);
42-
return template(data)
44+
return template({
45+
...data,
46+
...args,
47+
})
4348
};

packages/kaizen-cg/_templates/component/new/prompt.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ module.exports = [
1919
{
2020
type: 'input',
2121
name: 'description',
22-
message: "What's your component desctiption?",
22+
message: "What's your component description?",
2323
initial: "Component description placeholder"
2424
}
2525
]

packages/kaizen-cg/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@skilld/kaizen-cg",
3-
"version": "2.0.0-alpha.2",
3+
"version": "2.0.0-alpha.3",
44
"description": "Kaizen component generator",
55
"bin": "index.js",
66
"main": "index.js",

packages/kaizen-core/README.md

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,16 @@
99

1010
## What is this?
1111

12-
- This package several helper-components which are using on every project usually. And also it contains several css files which should be on every project neither.
12+
- This package contains several helper's components which we are using on every project usually. And also it contains several css files which attached globally to storybook and drupal by default.
1313

14-
## Entity fake link helper
14+
### Entity fake link helper
1515

1616
This component helps you to easily simulate link to some wrapper, based on link inside of this wrapper. For example sometimes you need a whole teaser clickable based on its title's link-field. This script requires two data attributes added to the wrapper and to the link itself.
1717

1818
Example of usage:
1919
```
2020
<div class="m-teaser" data-h-entity-fake-link-container>
21-
<a href="#" data-h-entity-fake-link-target>Lorem ipsum</a>
21+
<a class="m-teaser__link" href="#" data-h-entity-fake-link-target>Lorem ipsum</a>
2222
</div>
2323
```
2424
Note that you can even skip this attribute `data-h-entity-fake-link-target` if your clickable-container contains only one link inside. The script has a fallback in that case and it will take first link in the tree if target data attribute wasn't added for the link.
@@ -35,22 +35,22 @@ export const basic = (args = {}) => {
3535
...
3636
};
3737
```
38-
Styles for this helper called globally in storybook.
38+
Styles for this helper called globally for storybook, so you don't need to import them manually (but actually the styles of this component contains only `cursor: pointer;` for the wrapper)
3939

40-
In Drupal this helper is not added by default, so you have to call `@skilld/kaizen-core/helpers/entity-fake-link/entity-fake-link.css` file from `src/` folder and import also `@skilld/kaizen-core/helpers/entity-fake-link/h-entity-fake-link` javascript file and call it same way you calling this script in storybook.
40+
In Drupal this helper is not added by default, so if you need it - you have to manually import this component in `src/` folder and call its js/css globally or using drupal's libraries.
4141

42-
## Focus visible helper
42+
### Focus visible helper
4343

44-
This script improves focus experience for the people who don't need a visual accessibility. For example native browser's behavior when you clicking on the button - it adds focus rings automatically, but what if user doesn't have a problems with health? Browser's native focus rings creates sometimes a lot of unnecessary noise and worsens perception of the site actually. So this helper component helps to show focus ring only to the people who really needs it (for example with that helper focus ring can be shown by pressing TAB key, but it will be hidden if interactive element was focused by using mouse)
44+
This script improves focus experience for the people who don't need a visual accessibility. For example a native browser's behavior when you clicking on the button - is to add a focus rings automatically around button, but what if user doesn't have a problems with health? Browser's native focus rings creates sometimes a lot of unnecessary noise and worsens perception of the site actually. So this helper component helps to show focus ring only to the people who really needs it (for example with that helper focus ring can be shown by pressing TAB key, but it will be hidden if interactive element was focused by using mouse's buttons)
4545

4646
This helper component is included globally already in storybook, when you installing [@skilld/kaizen-tg](https://www.npmjs.com/package/@skilld/kaizen-tg) theme. And also this script is included globally in `src/` folder (so Drupal have this script loaded by default too). You don't need to do anything manually with it.
4747

4848
You can read more about focus visible [here](https://www.npmjs.com/package/focus-visible).
4949

50-
## Root variables
51-
This script adds `style="--viewport-width: ...px; --viewport-height: ...px"` attribute with two css variables inside. These css variables changes dynamically on window.resize.
50+
### Root variables
51+
This script adds `style="--viewport-width: ...px; --viewport-height: ...px"` attribute with two css variables inside into html tag. These css variables changes dynamically on window.resize.
5252

53-
This script is useful for Safari browser on iOS for example. So if you need to get width or height of the viewport - you have to use these variables.
53+
This script is useful for Safari browser on iOS for example. So if you need to get a real width or height of the viewport - you have to use these variables.
5454

5555
You can use them for burger menus, dialogs, and other. Example of code:
5656
```
@@ -65,13 +65,12 @@ Also some bad example:
6565
height: 100vh;
6666
}
6767
```
68-
This is a bad example because in Safari browser on iPhone your element can be actually less or more than `100vh` sometimes. Because Safari is hiding top/bottom panels in browser often on scroll, after click on some specific element and so on. That's why you have to use instead:
69-
```
70-
.full-height-element {
71-
height: var(--viewport-height);
72-
}
73-
```
74-
In that case when Safari hiding its panels, this variable will get actually the real value of viewport.
68+
This is a bad example because in Safari browser on iPhone sometimes `100vh` is not always really 100% of the viewport's height. That's why you have to use those variables.
69+
70+
## Other kaizen's packages
71+
1. [kaizen-tg](https://www.npmjs.com/package/@skilld/kaizen-tg)
72+
2. [kaizen-cg](https://www.npmjs.com/package/@skilld/kaizen-cg)
73+
3. [kaizen-breakpoints](https://www.npmjs.com/package/@skilld/kaizen-breakpoints)
7574

7675
# License
7776

packages/kaizen-core/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@skilld/kaizen-core",
3-
"version": "2.0.0-alpha.1",
3+
"version": "2.0.0-alpha.2",
44
"description": "Kaizen core styles",
55
"main": "index.js",
66
"repository": {

packages/kaizen-tg/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,11 @@ Run `yarn storybook` from theme dir to init storybook
5151

5252
Run `yarn lint-fix` from theme dir
5353

54+
## Other kaizen's packages, included into `kaizen-tg` package.
55+
1. [kaizen-cg](https://www.npmjs.com/package/@skilld/kaizen-cg)
56+
2. [kaizen-core](https://www.npmjs.com/package/@skilld/kaizen-core)
57+
3. [kaizen-breakpoints](https://www.npmjs.com/package/@skilld/kaizen-breakpoints)
58+
5459
# License
5560

5661
This project is licensed under the MIT open source license.

packages/kaizen-tg/_templates/drupal-9-theme/new/package.json.t

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ to: <%= h.src() %>/<%= h.changeCase.lower(name) %>/package.json
99
"author": "Skilld",
1010
"license": "MIT",
1111
"devDependencies": {
12-
"@skilld/kaizen-cg": "^2.0.0-alpha.2",
12+
"@skilld/kaizen-cg": "^2.0.0-alpha.3",
1313
"@storybook/addon-essentials": "^6.4.19",
1414
"@storybook/addon-postcss": "^2.0.0",
1515
"@storybook/builder-webpack5": "^6.4.19",
@@ -25,8 +25,8 @@ to: <%= h.src() %>/<%= h.changeCase.lower(name) %>/package.json
2525
},
2626
"dependencies": {
2727
"@<%= h.changeCase.lower(name) %>/components": "^1.0.0",
28-
"@skilld/kaizen-breakpoints": "^2.0.0-alpha.2",
29-
"@skilld/kaizen-core": "^2.0.0-alpha.1",
28+
"@skilld/kaizen-breakpoints": "^2.0.0-alpha.3",
29+
"@skilld/kaizen-core": "^2.0.0-alpha.2",
3030
"autoprefixer": "^10.4.4",
3131
"cross-env": "^7.0.3",
3232
"css-loader": "^6.7.1",

0 commit comments

Comments
 (0)