-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
23 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,28 @@ | ||
import React from 'react'; | ||
import { useTranslation } from 'react-i18next'; | ||
import { useSetRecoilState } from 'recoil'; | ||
import { Select } from 'fundamental-react'; | ||
import { Select, Option } from '@ui5/webcomponents-react'; | ||
import { languageAtom } from 'state/preferences/languageAtom'; | ||
import { Option } from 'fundamental-react/lib/Select/Select'; | ||
|
||
const AVAILABLE_LANGUAGES = [{ key: 'en', text: 'English' }]; | ||
|
||
export default function LanguageSettings() { | ||
const { t, i18n } = useTranslation(); | ||
const { t } = useTranslation(); | ||
const setLanguage = useSetRecoilState(languageAtom); | ||
|
||
const selectLanguage = ( | ||
event: React.MouseEvent<HTMLLIElement> | React.KeyboardEvent<HTMLLIElement>, | ||
language: Option, | ||
) => { | ||
setLanguage(language.key); | ||
const onChange = (event: any) => { | ||
const selectedLanguage = event.detail.selectedOption.value; | ||
setLanguage(selectedLanguage); | ||
}; | ||
|
||
return ( | ||
<div className="preferences-row"> | ||
<span className="fd-has-color-status-4">{t('settings.language')}</span> | ||
<Select | ||
options={AVAILABLE_LANGUAGES} | ||
selectedKey={i18n.language} | ||
onSelect={selectLanguage} | ||
/> | ||
<Select onChange={onChange}> | ||
{AVAILABLE_LANGUAGES.map(language => ( | ||
<Option value={language.key}>{language.text}</Option> | ||
))} | ||
</Select> | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,29 @@ | ||
import { useTranslation } from 'react-i18next'; | ||
import { useRecoilState } from 'recoil'; | ||
import { Select } from 'fundamental-react'; | ||
import { useSetRecoilState } from 'recoil'; | ||
import { Select, Option } from '@ui5/webcomponents-react'; | ||
import { pageSizeState } from 'state/preferences/pageSizeAtom'; | ||
const AVAILABLE_PAGE_SIZES = [10, 20, 50]; | ||
|
||
export default function OtherSettings() { | ||
const { t } = useTranslation(); | ||
|
||
const [pageSize, setPageSize] = useRecoilState(pageSizeState); | ||
const setPageSize = useSetRecoilState(pageSizeState); | ||
|
||
const pageSizeOptions = AVAILABLE_PAGE_SIZES.map(s => ({ | ||
key: s.toString(), | ||
text: s.toString(), | ||
})); | ||
const onChange = (event: any) => { | ||
const selectedSize = event.detail.selectedOption.value; | ||
setPageSize(parseInt(selectedSize)); | ||
}; | ||
|
||
return ( | ||
<div className="preferences-row"> | ||
<span className="fd-has-color-status-4"> | ||
{t('settings.other.default-page-size')} | ||
</span> | ||
<Select | ||
options={pageSizeOptions} | ||
selectedKey={pageSize.toString()} | ||
onSelect={(_, { key }) => setPageSize(parseInt(key))} | ||
/> | ||
<Select onChange={onChange}> | ||
{AVAILABLE_PAGE_SIZES.map(size => ( | ||
<Option value={size.toString()}>{size.toString()}</Option> | ||
))} | ||
</Select> | ||
</div> | ||
); | ||
} |