8000 GitHub - Katochimoto/xblocks-core at 2.0.0
[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

##Dependencies

##Browser support

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

##Example

var xblocks = require('xblocks');
var classnames = require('classnames');

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

    propTypes: {
        'id': React.PropTypes.string,
        'class': React.PropTypes.string,
        'alt': React.PropTypes.string,
        'size': React.PropTypes.oneOf(['s', 'm', 'l', 'xl']),
        'type': React.PropTypes.oneOf(['remove', 'notification', 'check', 'dropdown']),
        'active': React.PropTypes.bool,
        'disabled': React.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
xblocks.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
32F4
0