8000 GitHub - Katochimoto/xblocks-core at 2.0.3
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Katochimoto/xblocks-core

Repository files navigation

xblocks-core

HTML core custom elements

Build Status NPM version Dependency Status devDependency Status Code Climate Test Coverage Inline docs

##Dependencies

##Browser support

  • Firefox 14+
  • Internet Explorer 9+
  • Chrome 4+
  • Safari 4+
  • Opera 12+

##Example

import { PropTypes } from 'react';
import { view } from 'xblocks-core';
import classnames from 'classnames';

// define jsx view
view.register('xb-ico', {
    displayName: 'xb-ico',

    propTypes: {
        'size': PropTypes.oneOf([ 's', 'm', 'l', 'xl' ]),
        'type': PropTypes.oneOf([ 'remove', 'notification', 'check', 'dropdown' ]),
        'active': PropTypes.bool,
        'disabled': PropTypes.bool
    },

    getDefaultProps: function() {
        return {
            'size': 'm',
            'children': String.fromCharCode(160)
        };
    },

    render: function() {
        var classes = {
            'xb-ico': true,
            '_active': this.props.active,
            '_disabled': this.props.disabled
        };

        if (this.props.type) {
            classes['_type-' + this.props.type] = true;
        }

        if (this.props.size) {
            classes['_size-' + this.props.size] = true;
        }

        classes = classnames(classes);

        return (
            <span className={classes}
                data-xb-content={this.props._uid}>{this.props.children}</span>
        );
    }
});
// define element
import { create } from 'xblocks-core';

create('xb-ico');
<!-- element usage -->
<xb-ico type="notification">8</xb-ico>

##Install

npm install xblocks-core
bower install xblocks-core

Stats

NPM NPM

About

HTML core custom elements

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published
0