@@ -3,6 +3,14 @@ import Radium from 'radium';
3
3
import ReactDOM from 'react-dom' ;
4
4
import key from 'keymaster' ;
5
5
6
+ import WebFont from 'webfontloader' ;
7
+
8
+ WebFont . load ( {
9
+ google : {
10
+ families : [ 'Overpass:400,700' ]
11
+ }
12
+ } ) ;
13
+
6
14
const ID = 'macro-onboarding-popup-wrapper' ;
7
15
8
16
if ( ! document . getElementById ( ID ) ) {
@@ -27,21 +35,28 @@ class OnboardingPopup extends Component {
27
35
this . close ( ) ;
28
36
} ) ;
29
37
}
30
- toggle ( ) {
31
- this . setState ( { show : this . state . show ? false : true } ) ;
32
- }
33
38
close ( ) {
34
39
this . setState ( { show : false } ) ;
35
40
}
36
41
cancel ( e ) {
37
42
e . stopPropagation ( ) ;
38
43
}
39
44
render ( ) {
40
- return this . state . show ? < div style = { styles . container } >
41
- < div style = { styles . modal } onClick = { ( ) => this . close ( ) } >
42
- < div style = { [ styles . dialog , this . props . style ] } onClick = { this . cancel } >
43
- < div style = { styles . header } >
44
- < h1 > Onboarding Panel for { this . name } </ h1 >
45
+ let shortcutHint1 = this . props . data . sections [ 0 ] . shortcuts [ 0 ] ;
46
+ let shortcutHint2 = this . props . data . sections [ 0 ] . shortcuts [ 1 ] ;
47
+ return this . state . show ? < div style = { styles . container } onClick = { ( ) => this . close ( ) } >
48
+ < div style = { styles . pointer } />
49
+ < div style = { styles . popup } onClick = { this . cancel } >
50
+ < p style = { [ styles . reset , styles . primary , { marginTop : '10px' } ] } > Press { shortcutHint1 . keys [ 0 ] . default } to { shortcutHint1 . name . toLowerCase ( ) } .</ p >
51
+ < p style = { [ styles . reset , styles . primary ] } > Press { shortcutHint2 . keys [ 0 ] . default } to { shortcutHint2 . name . toLowerCase ( ) } .</ p >
52
+ < p style = { styles . secondary } > Discover more { this . name } shortcuts by pressing Alt+/ or by clicking the Macro icon.</ p >
53
+ < div style = { styles . footer } >
54
+ < div style = { styles . button } onClick = { ( ) => this . close ( ) } >
55
+ < p style = { [ styles . reset , styles . secondary ] } > GOT IT</ p >
56
+ </ div >
57
+ < div style = { styles . plug } >
58
+ < p style = { [ styles . reset , styles . tertiary ] } > POWERED BY</ p >
59
+ < img style = { styles . icon } src = { icon } />
45
60
</ div >
46
61
</ div >
47
62
</ div >
@@ -50,66 +65,86 @@ class OnboardingPopup extends Component {
50
65
}
51
66
52
67
let styles = {
68
+ reset : {
69
+ marginTop : '0' ,
70
+ marginRight : '0' ,
71
+ marginBottom : '0' ,
72
+ marginLeft : '0'
73
+ } ,
74
+ primary : {
75
+ fontWeight : '700'
76
+ } ,
77
+ secondary : {
78
+ color : '#888'
79
+ } ,
80
+ tertiary : {
81
+ color : '#BBB' ,
82
+ fontSize : '9px' ,
83
+ paddingTop : '3px'
84
+ } ,
53
85
container : {
54
86
position : 'fixed' ,
55
- zIndex : '9000 ' ,
87
+ zIndex : '1000 ' ,
56
88
width : '100%' ,
57
89
height : '100%' ,
58
90
top : '0' ,
59
91
left : '0' ,
60
92
right : '0' ,
61
- bottom : '0'
62
- } ,
63
- overlay : {
64
- opacity : '0.2' ,
65
- position : 'fixed' ,
66
- backgroundColor : '#000000' ,
67
- zIndex : '7000' ,
68
- top : '0' ,
69
- left : '0' ,
70
- right : '0' ,
71
- bottom : '0'
93
+ bottom : '0' ,
94
+ fontFamily : 'Overpass' ,
95
+ fontSize : '12px' ,
96
+ lineHeight : '1.5'
72
97
} ,
73
- modal : {
74
- display : 'block' ,
98
+ popup : {
75
99
position : 'absolute' ,
76
- zIndex : '8000' ,
77
- outline : '0' ,
78
- top : '0' ,
79
- left : '0' ,
80
- right : '0' ,
81
- bottom : '0'
100
+ top : '10px' ,
101
+ right : '30px' ,
102
+ backgroundColor : '#F7FCFF' ,
103
+ width : '250px' ,
104
+ padding : '15px' ,
105
+ boxShadow : '1px 3px 7px rgba(0, 0, 0, 0.3)' ,
106
+ borderRadius : '2px'
82
107
} ,
83
- dialog : {
84
- width : '600px' ,
85
- position : 'fixed' ,
86
- top : '50%' ,
87
- left : '50%' ,
88
- transform : 'translate(-50%, -50%)' ,
89
- boxShadow : '0px 2px 4px rgba(0, 0, 0, 0.5)' ,
90
- outline : '0' ,
91
- backgroundColor : '#FFFFFF' ,
92
- padding : '20px' ,
93
- maxHeight : '90vh' ,
94
- overflowY : 'scroll' ,
95
- borderRadius : '15px'
108
+ button : {
109
+ backgroundColor : '#FFF' ,
110
+ padding : '3px 15px' ,
111
+ color : '#AAA' ,
112
+ borderRadius : '3px' ,
113
+ border : '1px solid #DDD' ,
114
+ cursor : 'pointer' ,
115
+ fontWeight : '700' ,
116
+ fontSize : '11px' ,
117
+ ':hover' : {
118
+ color : '#2391E1'
119
+ }
96
120
} ,
97
- header : {
121
+ footer : {
98
122
display : 'flex' ,
99
123
justifyContent : 'space-between' ,
100
- marginBottom : '5px ' ,
101
- paddingLeft : '15px'
124
+ alignItems : 'center ' ,
125
+ marginTop : '15px'
102
126
} ,
103
- body : {
104
- display : 'flex' ,
105
- justifyContent : 'space-around'
127
+ plug : {
128
+ display : 'flex'
129
+ } ,
130
+ icon : {
131
+ width : '20px' ,
132
+ height : '20px' ,
133
+ marginLeft : '7px'
134
+ } ,
135
+ pointer : {
136
+ width : '0' ,
137
+ height : '0' ,
138
+ position : 'absolute' ,
139
+ top : '2px' ,
140
+ right : '35px' ,
141
+ borderLeft : '10px solid transparent' ,
142
+ borderRight : '10px solid transparent' ,
143
+ borderBottom : '10px solid #F7FCFF' ,
144
+ zIndex : '300'
106
145
} ,
107
- col : {
108
- width : '45%'
109
- }
110
146
}
111
147
112
148
OnboardingPopup = Radium ( OnboardingPopup ) ;
113
149
114
150
ReactDOM . render ( < OnboardingPopup data = { data } name = { name } /> , document . getElementById ( ID ) ) ;
115
-
0 commit comments