3.2.5 • Published 5 months ago

evokit v3.2.5

Weekly downloads
734
License
MIT
Repository
github
Last release
5 months ago

EvoKit

npm.io npm.io

Allows you to divide the user interface into independent blocks and think about them separately. EvoKit blocks can be declared with createBlock.


Usage

Peer dependencies react, prop-types

npm install evokit --save

Create block

?> createBlock(tagName, blockName, blockMods, preset)

See example create block

  • tagName - string, html tag
  • blockName - string, block name
  • blockMods - array of string, block modifier key list
  • preset - object, default value: { b: 'ek-', m: '_', v: '_', css: null }

More about preset:

KeyTypeDefault valueDescription
bstringek-block class name prefix: {b}blockName => ek-blockName
mstring_block modifier name separator: blockName{m}modName => blockName_modName
vstring_block modifier value separator: modName{v}modVal => modName_modVal
cssobjectnullobject CSS Modules classes
import { createBlock } from 'evokit';

const Footer = createBlock('div', 'footer', ['padding']);

<Footer /> // <div class="ek-footer"></div>
<Footer footer-padding='xxl' /> // <div class="ek-footer ek-footer_padding_xxl"></div>

// ADDITIONAL PROPS:
<Footer footer-as='span' /> // <span class="ek-footer ek-footer_padding_xxl"></span>
<Footer footer-preset={{ css: cssModules }} /> // CSS Modules

CSS Modules with custom class prefix mp-:

/* css-modules.css */

.mp-footer {}
.mp-footer_padding_xs {}
import { createBlock } from 'evokit';
import styles from 'css-modules.css';

const Footer = createBlock('div', 'footer', ['padding'], {
    b: 'mp-',
    css: styles,
});

<Footer /> // <div class="mp-footer"></div>
<Footer footer-padding='xs' /> // <div class="mp-footer mp-footer_padding_xs"></div>

With props

?> withProps(Block, props)

Return block with default props

See example with props

import { createBlock, withProps } from 'evokit';
// import styles from 'css-modules.css';

const Footer = createBlock('div', 'footer', ['padding']);

const FooterXXL = withProps(Footer, {
    'footer-as': 'table',
    'footer-padding': 'xxl',
});

// const FooterCssModules = withProps(Footer, {
//     'footer-preset': {
//         css: styles,
//     },
// });

<Footer /> // <div class="ek-footer"></div>
<FooterXXL /> // <table class="ek-footer ek-footer_padding_xxl"></table>
<FooterXXL footer-as='span' footer-padding='m' /> // <span class="ek-footer ek-footer_padding_m"></span>
3.2.5

5 months ago

3.2.4

6 months ago

3.2.3

2 years ago

3.2.2

4 years ago

3.2.2-alpha.0

4 years ago

3.2.1

4 years ago

3.2.0

4 years ago

3.1.0

5 years ago

3.1.0-alpha.0

5 years ago

3.0.3

5 years ago

3.0.2

5 years ago

3.0.1

5 years ago

3.0.0

5 years ago

3.0.0-alpha.2

5 years ago

3.0.0-alpha.1

5 years ago

3.0.0-alpha.0

5 years ago

2.1.5

5 years ago

2.1.4

5 years ago

2.1.3

5 years ago

2.1.2

5 years ago

2.1.1

5 years ago

2.1.0

5 years ago

2.0.9

5 years ago

2.0.8

5 years ago

2.0.7

5 years ago

2.0.6

5 years ago

2.0.5

5 years ago

2.0.4

5 years ago

2.0.3

6 years ago

2.0.2

6 years ago

2.0.1

6 years ago

2.0.0

6 years ago

1.1.6

6 years ago

1.1.5

6 years ago

1.1.4

6 years ago

1.1.3

6 years ago

1.1.2

6 years ago

1.1.1

6 years ago

1.1.0

6 years ago

1.0.12

6 years ago

1.0.11

6 years ago

1.0.10

6 years ago

1.0.9

6 years ago

1.0.8

6 years ago

1.0.7

6 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago