@@ -2,26 +2,32 @@ import React from 'react';
22import { CompoundButton } from '@fluentui/react/lib/Button' ;
33import { Modal } from '@fluentui/react/lib/Modal' ;
44import {
5- Stack , IStackTokens , getTheme , IconButton , mergeStyleSets
5+ Stack , IStackTokens , IconButton , mergeStyleSets , useTheme
66} from '@fluentui/react' ;
7+ import { VscCloud , VscBeaker } from 'react-icons/vsc' ;
8+ import { SiWebassembly } from 'react-icons/si' ;
79import { getContentStyles , getIconButtonStyles } from '~/styles/modal' ;
8- import { RuntimeType } from "~/services/config" ;
10+ import { RuntimeType } from '~/services/config' ;
11+ import './EnvironmentSelectModal.css' ;
912
1013const options = [
1114 {
1215 label : 'Go Playground' ,
1316 description : 'Build and run code on official Go playground server.' ,
1417 type : RuntimeType . GoPlayground ,
18+ icon : < VscCloud />
1519 } ,
1620 {
1721 label : 'Go Playground (GoTip)' ,
1822 description : 'Run on server with a current unstable development build of Go.' ,
1923 type : RuntimeType . GoTipPlayground ,
24+ icon : < VscBeaker />
2025 } ,
2126 {
2227 label : 'WebAssembly' ,
2328 description : 'Run Go code in your web browser with access to JS API.' ,
2429 type : RuntimeType . WebAssembly ,
30+ icon : < SiWebassembly />
2531 }
2632]
2733
@@ -40,7 +46,7 @@ interface Props {
4046const EnvironmentSelectModal : React . FC < Props > = ( {
4147 isOpen, onClose, value
4248} ) => {
43- const theme = getTheme ( ) ;
49+ const theme = useTheme ( ) ;
4450 const contentStyles = getContentStyles ( theme ) ;
4551 const iconButtonStyles = getIconButtonStyles ( theme ) ;
4652 const stackTokens : IStackTokens = { childrenGap : 10 } ;
@@ -64,13 +70,18 @@ const EnvironmentSelectModal: React.FC<Props> = ({
6470 < div className = { contentStyles . body } >
6571 < Stack tokens = { stackTokens } >
6672 {
67- options . map ( ( { label, description, type} ) => (
73+ options . map ( ( { label, description, type, icon } ) => (
6874 < CompoundButton
6975 key = { type }
7076 secondaryText = { description }
7177 checked = { type === value }
7278 className = { buttonStyles . button }
7379 onClick = { ( ) => onClose ?.( type ) }
80+ onRenderIcon = { ( ) => (
81+ < div className = "EnvironmentSelectButton__icon" >
82+ { icon }
83+ </ div >
84+ ) }
7485 >
7586 { label }
7687 </ CompoundButton >
0 commit comments