Odo Base Component
Base component for odo components. Includes media query listeners and exports base globals
Install
npm install @odopod/odo-base-component --save
Quick Start
import OdoBaseComponent from '@odopod/odo-base-component';
class CoolModule extends OdoBaseComponent {
constructor(element) {
super(element, true);
this.onMediaQueryChange();
}
onMediaQueryChange() {
this.element.className = '';
if (this.breakpoint.matches('xs') || this.breakpoint.matches('sm')) {
this.element.classList.add('xs-or-sm');
} else {
this.element.classList.add('md-or-lg');
}
this.element.classList.add('cool--' + OdoBaseComponent.breakpoint.current);
}
}
Visit the Odo component directory for demos, code examples, and documentation.