@@ -2,26 +2,32 @@ import React from 'react';
2
2
import { CompoundButton } from '@fluentui/react/lib/Button' ;
3
3
import { Modal } from '@fluentui/react/lib/Modal' ;
4
4
import {
5
- Stack , IStackTokens , getTheme , IconButton , mergeStyleSets
5
+ Stack , IStackTokens , IconButton , mergeStyleSets , useTheme
6
6
} from '@fluentui/react' ;
7
+ import { VscCloud , VscBeaker } from 'react-icons/vsc' ;
8
+ import { SiWebassembly } from 'react-icons/si' ;
7
9
import { getContentStyles , getIconButtonStyles } from '~/styles/modal' ;
8
- import { RuntimeType } from "~/services/config" ;
10
+ import { RuntimeType } from '~/services/config' ;
11
+ import './EnvironmentSelectModal.css' ;
9
12
10
13
const options = [
11
14
{
12
15
label : 'Go Playground' ,
13
16
description : 'Build and run code on official Go playground server.' ,
14
17
type : RuntimeType . GoPlayground ,
18
+ icon : < VscCloud />
15
19
} ,
16
20
{
17
21
label : 'Go Playground (GoTip)' ,
18
22
description : 'Run on server with a current unstable development build of Go.' ,
19
23
type : RuntimeType . GoTipPlayground ,
24
+ icon : < VscBeaker />
20
25
} ,
21
26
{
22
27
label : 'WebAssembly' ,
23
28
description : 'Run Go code in your web browser with access to JS API.' ,
24
29
type : RuntimeType . WebAssembly ,
30
+ icon : < SiWebassembly />
25
31
}
26
32
]
27
33
@@ -40,7 +46,7 @@ interface Props {
40
46
const EnvironmentSelectModal : React . FC < Props > = ( {
41
47
isOpen, onClose, value
42
48
} ) => {
43
- const theme = getTheme ( ) ;
49
+ const theme = useTheme ( ) ;
44
50
const contentStyles = getContentStyles ( theme ) ;
45
51
const iconButtonStyles = getIconButtonStyles ( theme ) ;
46
52
const stackTokens : IStackTokens = { childrenGap : 10 } ;
@@ -64,13 +70,18 @@ const EnvironmentSelectModal: React.FC<Props> = ({
64
70
< div className = { contentStyles . body } >
65
71
< Stack tokens = { stackTokens } >
66
72
{
67
- options . map ( ( { label, description, type} ) => (
73
+ options . map ( ( { label, description, type, icon } ) => (
68
74
< CompoundButton
69
75
key = { type }
70
76
secondaryText = { description }
71
77
checked = { type === value }
72
78
className = { buttonStyles . button }
73
79
onClick = { ( ) => onClose ?.( type ) }
80
+ onRenderIcon = { ( ) => (
81
+ < div className = "EnvironmentSelectButton__icon" >
82
+ { icon }
83
+ </ div >
84
+ ) }
74
85
>
75
86
{ label }
76
87
</ CompoundButton >
0 commit comments