Skip to content

Commit

Permalink
Use selected language for SingleChoice options
Browse files Browse the repository at this point in the history
  • Loading branch information
Keskimaki committed Mar 6, 2023
1 parent e4d8839 commit 7374929
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/client/components/Choices/SingleChoice.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
import React from 'react'
import { Controller } from 'react-hook-form'
import { RadioGroup, FormControlLabel, Radio, Box } from '@mui/material'
import { InputProps, SingleChoiceType } from '../../types'

const SingleChoice = ({ control, watch, question, children }: InputProps) => {
import { InputProps, Locales, SingleChoiceType } from '../../types'

const SingleChoice = ({
control,
watch,
question,
children,
language,
}: InputProps) => {
if (question.visibility?.options) {
const [...options] = question.visibility.options

Expand All @@ -26,7 +33,7 @@ const SingleChoice = ({ control, watch, question, children }: InputProps) => {
<FormControlLabel
key={singleOption.id as string}
value={singleOption.id}
label={singleOption.label.en}
label={singleOption.label[language as keyof Locales]}
control={<Radio />}
/>
)
Expand Down

0 comments on commit 7374929

Please sign in to comment.