Skip to content

Commit 1c57752

Browse files
authored
Fix environment selector modal (#186)
* fix(ui): fix theme in environment select modal * feat(ui): add icons for environment names
1 parent 4f58e6b commit 1c57752

File tree

2 files changed

+20
-4
lines changed

2 files changed

+20
-4
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
.EnvironmentSelectButton__icon {
2+
color: var(--color-idle);
3+
margin-right: 12px;
4+
font-size: 2em;
5+
}

web/src/components/modals/EnvironmentSelectModal/EnvironmentSelectModal.tsx

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,32 @@ import React from 'react';
22
import { CompoundButton } from '@fluentui/react/lib/Button';
33
import { Modal } from '@fluentui/react/lib/Modal';
44
import {
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';
79
import { getContentStyles, getIconButtonStyles } from '~/styles/modal';
8-
import {RuntimeType} from "~/services/config";
10+
import {RuntimeType} from '~/services/config';
11+
import './EnvironmentSelectModal.css';
912

1013
const 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 {
4046
const 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

Comments
 (0)