The JavaScript
Eslint
ES linting is used in the UI Toolkit to maintain good and unified coding standards. The same eslint config should be used across all our products and can be installed via NPM here.
Importing modules
The JavaScript is written in ES6 Modules and the following modules are available to import from the UI Toolkit.
The JavaScript modules are due to be refactored as soon as possible, so bare that in mind when using that you may need to update your code when importing a newer version of the UI Toolkit.
Base
import '@pod-point/pod-point-ui-toolkit';
Detects very basic but useful info about screen size and device:
window.isTouchDevice
detects if touch device
Also adds a class to the body to identify if desktop or touch device .is-desktop
or .is-touch
window.isMobileSize
detects if window width is under 800px
window.isIE
detects if browser is IE
window.isIE10OrBelow
detects if browser is IE10 or below
Toggle Element
import { toggleElement } from '@pod-point/pod-point-ui-toolkit';
See usage here.
Accordion
import { accordion } from '@pod-point/pod-point-ui-toolkit';
See usage here.