@@ -15,24 +15,32 @@ const reducer = combineReducers({ sketcher: sketcherReducer });
1515const enhancer = compose ( applyMiddleware ( thunkMiddleware , promiseMiddleware ( ) , createLogger ( { collapsed : true } ) ) ) ;
1616const store = createStore ( reducer , enhancer ) ;
1717
18- // prepare html (SHOULDN'T BE DONE LIKE THIS)
19- document . body . style . margin = 0 ;
20- document . body . style . padding = 0 ;
21- document . body . style . height = '100%' ;
22- document . documentElement . style . height = '100%' ;
23- document . documentElement . style . overflow = 'hidden' ;
24- document . getElementById ( 'app' ) . style . height = '100%' ;
25-
18+ // add actions to window
2619import actionWrapper from 'redux-action-wrapper' ;
2720import * as actions from './src/actions/index.js' ;
2821window . actions = actionWrapper ( actions , store . dispatch ) ;
2922
23+ // add model to store
3024import modelData from './models/noodlebot.d3sketch' ;
3125import JSONToSketchData from './src/shape/JSONToSketchData.js' ;
32- ( async ( ) => {
33- const data = await JSONToSketchData ( JSON . parse ( modelData ) ) ;
26+ JSONToSketchData ( JSON . parse ( modelData ) ) . then ( data => {
3427 store . dispatch ( actions . openSketch ( { data } ) ) ;
35- } ) ( ) ;
28+ } ) ;
29+
30+ // default css
31+ import jss from 'jss' ;
32+ import preset from 'jss-preset-default' ;
33+ import normalize from 'normalize-jss' ;
34+ jss . setup ( preset ( ) ) ;
35+ jss . createStyleSheet ( {
36+ '@global body, html, #app' : {
37+ height : '100%'
38+ } ,
39+ '@global body' : {
40+ overflow : 'hidden'
41+ } ,
42+ ...normalize
43+ } ) . attach ( ) ;
3644
3745// render dom
3846import React from 'react' ;
0 commit comments