Skip to content

Commit

Permalink
Added es6 version of JS
Browse files Browse the repository at this point in the history
  • Loading branch information
dkeeghan committed Jul 10, 2020
1 parent d340a49 commit 56b6998
Show file tree
Hide file tree
Showing 7 changed files with 547 additions and 5 deletions.
29 changes: 29 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -604,6 +604,17 @@ var bp = require('@deloitte-digital-au/ddbreakpoints');

Otherwise, ```DD.bp``` is used as a namespace on the window object.

#### ES6 version

```js
// ES6
import DDBreakpoints from '@deloitte-digital-au/ddbreakpoints/lib/dd.breakpoints.es6';
```

There is also an ES6 version that follows the exact same approach as the UMD version.

### The library

There are two main functions for the JS library.

#### `.get()`
Expand All @@ -624,6 +635,20 @@ DD.bp.get(0, 500);
DD.bp.get('s,l');
```

Or in ES6 replace `DD.bp` with `DDBreakpoints` (or whatever variable you've assigned the import to).

```javascript
DDBreakpoints.get(min /* string || number */, max = 0 /* string || number */, property = 'width' /* string */);

// examples
DDBreakpoints.get('s');
DDBreakpoints.get('s', 'l');
DDBreakpoints.get(0, 500);

// string notation
DDBreakpoints.get('s,l');
```

There is also a shortcut function for height based media queries

```javascript
Expand Down Expand Up @@ -682,6 +707,10 @@ Make sure to ensure that the values used here match the values used in the SCSS.

## Change log

`2.0.3` - July 2020

- Updated JS library to support es6 while maintaining old version for backwards compatibility. Use `dd.breakpoints.es6.js` for the es6 version.

`2.0.2` - June 2020

- Resolved bug in max breakpoints calculations when using `bp.get(min, max)`.
Expand Down
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "DDBreakpoints",
"version": "2.0.2",
"version": "2.0.3",
"homepage": "https://github.com/DeloitteDigitalAPAC/DDBreakpoints",
"authors": [ "Deloitte Digital Australia" ],
"description": "Breakpoints SCSS Mixin and JavaScript tool, used to accelerate the development process of responsive pages.",
Expand Down
Loading

0 comments on commit 56b6998

Please sign in to comment.