Socket
Socket
Sign inDemoInstall

evokit

Package Overview
Dependencies
6
Maintainers
1
Versions
51
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    evokit

EvoKit — Tool for creating React UI Block


Version published
Weekly downloads
885
decreased by-14.74%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

EvoKit

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>

Keywords

FAQs

Last updated on 04 Dec 2023

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc