-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
62 lines (53 loc) · 1.67 KB
/
main.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
import React from 'react';
import { render, hydrate } from 'react-dom';
import Card from './src/js/card.jsx';
window.ProtoGraph = window.ProtoGraph || {};
window.ProtoGraph.Card = window.ProtoGraph.Card || {};
ProtoGraph.Card.toFooter = function() {
this.cardType = 'FooterCard';
}
ProtoGraph.Card.toFooter.prototype.init = function(options) {
this.options = options;
}
ProtoGraph.Card.toFooter.prototype.getData = function(data) {
return this.containerInstance.exportData();
}
ProtoGraph.Card.toFooter.prototype.renderFourCol = function(data) {
this.mode = 'col4';
this.render();
}
ProtoGraph.Card.toFooter.prototype.renderSixteenCol = function(data) {
this.mode = 'col16';
this.render();
}
ProtoGraph.Card.toFooter.prototype.renderScreenshot = function(data) {
this.mode = 'screenshot';
this.render();
}
ProtoGraph.Card.toFooter.prototype.render = function() {
if(this.options.isFromSSR){
hydrate(
<Card
mode={this.mode || "col3"}
dataJSON={this.options.initialState.dataJSON}
/>,
this.options.selector
);
} else {
render(
<Card
dataURL = { this.options.data_url }
schemaURL = { this.options.schema_url }
siteConfigs = { this.options.site_configs }
siteConfigURL = { this.options.site_config_url }
mode = { this.mode || "col3"}
ref = {
(e) => {
this.containerInstance = this.containerInstance || e;
}
}
/>,
this.options.selector
);
}
}