Repository navigation
Expand file tree
/
Copy pathdev.js
More file actions
143 lines (125 loc) · 2.55 KB
/
Copy pathdev.js
File metadata and controls
143 lines (125 loc) · 2.55 KB
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
import React, { Component } from 'react'
import ReactDOM from 'react-dom'
import styledNormalize from 'styled-normalize'
import { injectGlobal } from 'styled-components'
import styled, { css } from 'styled-components'
import TemplateEditor from './src/TemplateEditor'
// material ui typography fix
window.__MUI_USE_NEXT_TYPOGRAPHY_VARIANTS__ = true;
/**
* Media queries [wip]
*
*/
const sizes = {
size16: 1600,
size14: 1400,
size13: 1300,
giant: 1170,
desktop: 992,
tablet: 768,
phonelet: 500,
phone: 376
}
const media = Object.keys(sizes).reduce((accumulator, label) => {
const emSize = sizes[label] / 16
accumulator[label] = (...args) => css`
@media (min-width: ${emSize}em) {
${css(...args)}
}
`
return accumulator
}, {})
// global styls inject
injectGlobal`
${styledNormalize}
html {
box-sizing: border-box;
text-size-adjust: 100%;
text-rendering: optimizeLegibility;
height: 100%;
min-height: 100%;
font-size:14px;
}
*,
*::before,
*::after {
box-sizing: inherit;
}
body {
height: 100%;
min-height: 100%;
margin: 0;
font-family: sans-serif;
background: rgb(238, 238, 238);
}
`
const Container = styled.div`
position: relative;
margin: 0 auto;
display: flex;
flex-flow: column nowrap;
align-items: center;
max-width: initial;
max-width: auto;
min-height: 300px;
padding: 0 15px;
${media.desktop`
max-width: 992px;
`}
${media.size13`
max-width: 1170px;
`}
`
/**
* Sample App for dev
*
*/
class ExampleApp extends Component {
constructor(props) {
super(props)
this.syncEditor = this.syncEditor.bind(this)
}
// editor's changes callback
syncEditor(data) {
console.log('current structure:', data)
}
render() {
return (
<Container>
<h4>Editor</h4>
<TemplateEditor theme={theme} structure={null} onChange={this.syncEditor} />
</Container>
)
}
}
/**
* Theme [wip]
*
*/
const theme = {
colors: {
primary: '#3f2b4f',
secondary: '#b40766',
textDark: '#333',
textLight: '#eee',
textSuccess: '#137913',
textError: '#ef3846'
},
fonts: {
h1Family: 'Roboto',
h2Family: 'Roboto',
h3Family: 'Roboto',
h4Family: 'Roboto',
h5Family: 'Roboto',
h6Family: 'Roboto',
pFamily: 'Roboto'
}
}
/**
* Render
*
*/
ReactDOM.render(
<ExampleApp />,
document.getElementById('root')
)