Skip to content

Commit

Permalink
refactor: change CheckboxGroup component to antdesign Radio component
Browse files Browse the repository at this point in the history
  • Loading branch information
andyhuang18 committed Apr 17, 2024
1 parent 9747b76 commit 9e88112
Showing 1 changed file with 12 additions and 19 deletions.
31 changes: 12 additions & 19 deletions src/pages/Options/Options.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { useState, useEffect } from 'react';
import { Stack, ChoiceGroup, IChoiceGroupOption } from 'office-ui-fabric-react';
import { Checkbox } from 'antd';
import { Stack } from 'office-ui-fabric-react';
import { Checkbox, Radio, Space } from 'antd';

import { importedFeatures } from '../../../README.md';
import optionsStorage, { HypercrxOptions } from '../../options-storage';
Expand All @@ -9,17 +9,6 @@ import { HYPERCRX_GITHUB } from '../../constant';
import TooltipTrigger from '../../components/TooltipTrigger';
import './Options.css';

const localeOptions: IChoiceGroupOption[] = [
{
key: 'en',
text: 'English',
},
{
key: 'zh_CN',
text: '简体中文 (Simplified Chinese)',
},
];

const stacksStyleOptions = {
headerStack: {
paddingBottom: '10px',
Expand Down Expand Up @@ -91,14 +80,18 @@ const Options = (): JSX.Element => {
<p>
{getMessageByLocale('options_locale_toolTip', options.locale)} :
</p>
<ChoiceGroup
defaultSelectedKey={options.locale}
options={localeOptions}
onChange={async (e, option: any) => {
await optionsStorage.set({ locale: option.key });
<Radio.Group
defaultValue={options.locale}
onChange={async (e) => {
await optionsStorage.set({ locale: e.target.value });
setOptions(await optionsStorage.getAll());
}}
/>
>
<Space direction="vertical">
<Radio value={'en'}>English</Radio>
<Radio value={'zh_CN'}>简体中文 (Simplified Chinese)</Radio>
</Space>
</Radio.Group>
</Stack>
</Stack.Item>
<Stack.Item className="Box">
Expand Down

0 comments on commit 9e88112

Please sign in to comment.