How to use the belter/src.toCSS function in belter

To help you get started, we’ve selected a few belter examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github krakenjs / zoid / dist / module / component / component / index.js View on Github external
// A json based spec describing what kind of props the component accepts. This is used to validate any props before
        // they are passed down to the child.

        this.builtinProps = getInternalProps();
        this.props = options.props || {};

        // The dimensions of the component, e.g. { width: '300px', height: '150px' }

        var _ref = options.dimensions || {},
            _ref$width = _ref.width,
            width = _ref$width === undefined ? DEFAULT_DIMENSIONS.WIDTH : _ref$width,
            _ref$height = _ref.height,
            height = _ref$height === undefined ? DEFAULT_DIMENSIONS.HEIGHT : _ref$height;

        this.dimensions = { width: toCSS(width), height: toCSS(height) };

        this.defaultEnv = options.defaultEnv;
        this.url = options.url || options.buildUrl;
        this.domain = options.domain;
        this.bridgeUrl = options.bridgeUrl;

        this.attributes = options.attributes || {};
        this.contexts = options.contexts || { iframe: true, popup: false };
        this.defaultContext = options.defaultContext || CONTEXT.IFRAME;

        this.autoResize = _typeof(options.autoResize) === 'object' ? options.autoResize : { width: Boolean(options.autoResize), height: Boolean(options.autoResize), element: 'body' };

        this.containerTemplate = options.containerTemplate || defaultContainerTemplate;
        this.prerenderTemplate = options.prerenderTemplate || defaultPrerenderTemplate;

        this.validate = options.validate;
github krakenjs / zoid / src / component / component / index.js View on Github external
this.allowedParentDomains = options.allowedParentDomains || WILDCARD;

        if (Component.components[this.tag]) {
            throw new Error(`Can not register multiple components with the same tag`);
        }

        // A json based spec describing what kind of props the component accepts. This is used to validate any props before
        // they are passed down to the child.

        this.builtinProps = getInternalProps();
        this.props = options.props || {};

        // The dimensions of the component, e.g. { width: '300px', height: '150px' }

        let { width = DEFAULT_DIMENSIONS.WIDTH, height = DEFAULT_DIMENSIONS.HEIGHT } = options.dimensions || {};
        this.dimensions = { width: toCSS(width), height: toCSS(height) };

        this.defaultEnv = options.defaultEnv;
        this.url = options.url || options.buildUrl;
        this.domain = options.domain;
        this.bridgeUrl = options.bridgeUrl;

        this.attributes = options.attributes || {};
        this.contexts = options.contexts || { iframe: true, popup: false };
        this.defaultContext = options.defaultContext || CONTEXT.IFRAME;

        this.autoResize = (typeof options.autoResize === 'object')
            ? options.autoResize
            : { width: Boolean(options.autoResize), height: Boolean(options.autoResize), element: 'body' };

        this.containerTemplate = options.containerTemplate || defaultContainerTemplate;
        this.prerenderTemplate = options.prerenderTemplate || defaultPrerenderTemplate;
github krakenjs / zoid / dist / module / component / parent / drivers.js View on Github external
resize: function resize(_ref) {
        var width = _ref.width,
            height = _ref.height;


        if (width) {
            this.container.style.width = toCSS(width);
            this.element.style.width = toCSS(width);
        }

        if (height) {
            this.container.style.height = toCSS(height);
            this.element.style.height = toCSS(height);
        }
    },
    show: function show() {
github paypal / paypal-checkout-components / src / zoid / buttons / container.jsx View on Github external
event.on(EVENT.RESIZE, ({ width: newWidth, height: newHeight }) => {
            if (typeof newWidth === 'number') {
                el.style.width = toCSS(newWidth);
            }

            if (typeof newHeight === 'number') {
                el.style.height = toCSS(newHeight);
            }
        });
    };
github krakenjs / zoid / src / component / templates / container.js View on Github external
event.on(EVENT.RESIZE, ({ width: newWidth, height: newHeight }) => {
            if (typeof newWidth === 'number') {
                div.style.width = toCSS(newWidth);
            }
    
            if (typeof newHeight === 'number') {
                div.style.height = toCSS(newHeight);
            }
        });
github krakenjs / zoid / src / component / templates / container.js View on Github external
event.on(EVENT.RESIZE, ({ width: newWidth, height: newHeight }) => {
            if (typeof newWidth === 'number') {
                div.style.width = toCSS(newWidth);
            }
    
            if (typeof newHeight === 'number') {
                div.style.height = toCSS(newHeight);
            }
        });
github paypal / paypal-checkout-components / src / zoid / buttons / container.jsx View on Github external
event.on(EVENT.RESIZE, ({ width: newWidth, height: newHeight }) => {
            if (typeof newWidth === 'number') {
                el.style.width = toCSS(newWidth);
            }

            if (typeof newHeight === 'number') {
                el.style.height = toCSS(newHeight);
            }
        });
    };
github krakenjs / zoid / dist / module / component / parent / drivers.js View on Github external
resize: function resize(_ref) {
        var width = _ref.width,
            height = _ref.height;


        if (width) {
            this.container.style.width = toCSS(width);
            this.element.style.width = toCSS(width);
        }

        if (height) {
            this.container.style.height = toCSS(height);
            this.element.style.height = toCSS(height);
        }
    },
    show: function show() {