-
-
Notifications
You must be signed in to change notification settings - Fork 171
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
10 changed files
with
221 additions
and
28 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
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
77 changes: 77 additions & 0 deletions
77
jsapp/js/components/processing/sidebar/sidebarLabelsSettings.component.tsx
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 |
---|---|---|
@@ -0,0 +1,77 @@ | ||
import React, {useState} from 'react'; | ||
import Button from 'js/components/common/button'; | ||
import KoboModal from 'js/components/modals/koboModal'; | ||
import KoboModalHeader from 'js/components/modals/koboModalHeader'; | ||
import KoboModalFooter from 'js/components/modals/koboModalFooter'; | ||
import KoboSelect from 'js/components/common/koboSelect'; | ||
import singleProcessingStore from 'js/components/processing/singleProcessingStore'; | ||
import styles from './sidebarLabelsSettings.module.scss'; | ||
import type {LanguageCode} from 'js/components/languages/languagesStore'; | ||
|
||
export default function SidebarLabelsSettings() { | ||
const [store] = useState(() => singleProcessingStore); | ||
const [isModalOpen, setIsModalOpen] = useState<boolean>(false); | ||
|
||
const [labelLanguage, setLabelLanguage] = useState<LanguageCode | string>( | ||
store.getCurrentlyDisplayedLanguage() | ||
); | ||
|
||
const displayedLanguageList = store.getDisplayedLanguagesList(); | ||
|
||
return ( | ||
<div className={styles.root}> | ||
<Button | ||
size='m' | ||
type='bare' | ||
label={t('Change question language')} | ||
color='storm' | ||
startIcon='globe-alt' | ||
onClick={() => setIsModalOpen(true)} | ||
/> | ||
<KoboModal | ||
isOpen={isModalOpen} | ||
onRequestClose={() => { | ||
setLabelLanguage(store.getCurrentlyDisplayedLanguage()); | ||
setIsModalOpen(false); | ||
}} | ||
size='medium' | ||
> | ||
<KoboModalHeader | ||
onRequestCloseByX={() => { | ||
setLabelLanguage(store.getCurrentlyDisplayedLanguage()); | ||
setIsModalOpen(false); | ||
}} | ||
> | ||
{t('Change label language')} | ||
</KoboModalHeader> | ||
<div className={styles.selectWrapper}> | ||
<KoboSelect | ||
label={t('Select displayed language')} | ||
name='displayedLanguage' | ||
type='outline' | ||
size='s' | ||
options={displayedLanguageList} | ||
selectedOption={labelLanguage} | ||
onChange={(languageCode) => { | ||
if (languageCode) { | ||
setLabelLanguage(languageCode); | ||
} | ||
}} | ||
/> | ||
</div> | ||
<KoboModalFooter> | ||
<Button | ||
label={<strong>{t('Apply')}</strong>} | ||
type='frame' | ||
color='light-blue' | ||
size='m' | ||
onClick={() => { | ||
store.setCurrentlyDisplayedLanguage(labelLanguage); | ||
setIsModalOpen(false); | ||
}} | ||
/> | ||
</KoboModalFooter> | ||
</KoboModal> | ||
</div> | ||
); | ||
} |
14 changes: 14 additions & 0 deletions
14
jsapp/js/components/processing/sidebar/sidebarLabelsSettings.module.scss
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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
@use 'scss/sizes'; | ||
|
||
$kobo-modal-padding: sizes.$x30; | ||
|
||
.root { | ||
height: sizes.$x48; | ||
display: flex; | ||
justify-content: right; | ||
align-items: center; | ||
} | ||
|
||
.selectWrapper { | ||
padding: $kobo-modal-padding; | ||
} |
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
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
Oops, something went wrong.