@@ -178,11 +178,62 @@ interface HeaderProps {
178
178
wasmAvailable : boolean ;
179
179
}
180
180
181
+ import { Manager , Target , Popper , Arrow } from 'react-popper' ;
182
+
183
+ const Header2 = ( ) => (
184
+ < div className = "header2" >
185
+ < button > BUILD</ button >
186
+ < Manager >
187
+ < Target >
188
+ < button > ...</ button >
189
+ </ Target >
190
+ < Popper className = "popper" placement = "bottom" >
191
+ < Arrow className = "popper__arrow" />
192
+ < div className = "popper__content" > < BuildMenu /> </ div >
193
+ </ Popper >
194
+ </ Manager >
195
+ </ div >
196
+ ) ;
197
+
198
+ const BuildMenu = ( ) => (
199
+ < div className = "build-options" >
200
+ < h1 className = "build-options__title" > What do you want to do?</ h1 >
201
+ < BuildOption
202
+ name = "Build"
203
+ description = "No bells and whistles, regular build coming right up :D"
204
+ />
205
+ < BuildOption
206
+ name = "ASM"
207
+ description = "Build and show the resulting assembly code."
208
+ />
209
+ < BuildOption
210
+ name = "LLVM IR"
211
+ description = "Build and show the resulting LLVM IR, LLVM's intermediate representation."
212
+ />
213
+ < BuildOption
214
+ name = "MIR"
215
+ description = "Build and show the resulting MIR, Rust's intermediate representation."
216
+ />
217
+ < BuildOption
218
+ name = "WASM"
219
+ description = "Build a WebAssembly module for web browsers, in the .WAT textual representation.
220
+ Note: WASM currently requires using the Nightly channel, selecting this option will switch to Nightly."
221
+ />
222
+ </ div >
223
+ ) ;
224
+
225
+ const BuildOption = ( { name, description} ) => (
226
+ < button className = "build-option" >
227
+ < span className = "build-option__name" > { name } </ span >
228
+ < span className = "build-option__description" > { description } </ span >
229
+ </ button >
230
+ ) ;
231
+
181
232
const mapStateToProps = ( state : State ) => {
182
- const { configuration : { channel, mode } } = state ;
233
+ const { configuration : { channel, mode } } = state ;
183
234
184
235
return {
185
- channel,
236
+ channel,
186
237
mode,
187
238
crateType : getCrateType ( state ) ,
188
239
tests : runAsTest ( state ) ,
@@ -195,22 +246,22 @@ const mapStateToProps = (state: State) => {
195
246
} ;
196
247
197
248
const mapDispatchToProps = ( {
198
- changeChannel,
199
- changeMode,
200
- clippy : performClippy ,
201
- compileToAssembly : performCompileToAssembly ,
202
- compileToLLVM : performCompileToLLVM ,
203
- compileToMir : performCompileToMir ,
204
- compileToWasm : performCompileToWasm ,
205
- execute : performExecute ,
206
- format : performFormat ,
207
- gistSave : performGistSave ,
208
- toggleConfiguration,
209
- } ) ;
249
+ changeChannel,
250
+ changeMode,
251
+ clippy : performClippy ,
252
+ compileToAssembly : performCompileToAssembly ,
253
+ compileToLLVM : performCompileToLLVM ,
254
+ compileToMir : performCompileToMir ,
255
+ compileToWasm : performCompileToWasm ,
256
+ execute : performExecute ,
257
+ format : performFormat ,
258
+ gistSave : performGistSave ,
259
+ toggleConfiguration,
260
+ } ) ;
210
261
211
- const ConnectedHeader = connect (
212
- mapStateToProps ,
213
- mapDispatchToProps ,
214
- ) ( Header ) ;
262
+ const ConnectedHeader = connect (
263
+ mapStateToProps ,
264
+ mapDispatchToProps ,
265
+ ) ( Header2 ) ;
215
266
216
- export default ConnectedHeader ;
267
+ export default ConnectedHeader ;
0 commit comments