1 | 'use strict';
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 | class ResponsiveGridsPresenter {
|
9 | constructor (data) {
|
10 | this.data = data;
|
11 | }
|
12 |
|
13 | |
14 |
|
15 |
|
16 | get responsiveGrids () {
|
17 | if (!this.data || !this.data.show) {
|
18 | return '';
|
19 | }
|
20 | const gridRules = Object.keys(this.data.show).map(breakpoint => {
|
21 | if (breakpoint === 'default') {
|
22 | return this.showOrHide(breakpoint);
|
23 | } else {
|
24 | return `${breakpoint}${this.showOrHide(breakpoint)}`;
|
25 | }
|
26 |
|
27 | });
|
28 | return gridRules.join(' ');
|
29 | }
|
30 |
|
31 |
|
32 | showOrHide (breakpoint) {
|
33 | return (this.data.show[breakpoint]) ? '12': '0';
|
34 | }
|
35 | }
|
36 |
|
37 | module.exports = ResponsiveGridsPresenter;
|