Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Radio, Stack } from '@mantine/core'
import React, { useContext, useState } from 'react'
import Radio from '#/components/common/radio'
import type { RadioOption } from '#/components/common/radio'
import AnalysisQuestionsContext from '#/components/processing/analysis/analysisQuestions.context'
import {
Expand Down Expand Up @@ -71,15 +71,19 @@ export default function SelectOneResponseForm(props: SelectOneResponseFormProps)
}

return (
<ResponseWrapper uuid={props.uuid} onClear={() => onRadioChange('')}>
<Radio
options={getOptions()}
name={question.labels._default}
onChange={onRadioChange}
selected={response}
isClearable
isDisabled={!props.canEdit}
/>
<ResponseWrapper uuid={props.uuid} onClear={() => setResponse('')}>
<Radio.Group>
<Stack gap={'xs'}>
{getOptions().map((option) => (
<Radio
value={option.value}
label={option.label}
onChange={(newResponse) => onRadioChange(newResponse.currentTarget.value)}
checked={response === option.value}
/>
))}
</Stack>
</Radio.Group>
</ResponseWrapper>
)
}
9 changes: 9 additions & 0 deletions jsapp/js/theme/kobo/Radio.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
.label {
padding-left: 6px;
font-size: var(--mantine-font-size-md);
color: var(--mantine-color-gray-1);
}

.radio {
cursor: pointer;
}
6 changes: 6 additions & 0 deletions jsapp/js/theme/kobo/Radio.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { Radio } from '@mantine/core'
import classes from './Radio.module.css'

export const RadioThemeKobo = Radio.extend({
classNames: classes,
})
2 changes: 2 additions & 0 deletions jsapp/js/theme/kobo/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { TableThemeKobo } from './Table'
import { TagsInputThemeKobo } from './TagsInput'
import { ThemeIconThemeKobo } from './ThemeIcon'
import { TooltipThemeKobo } from './Tooltip'
import {RadioThemeKobo} from './Radio'

export const themeKobo = createTheme({
primaryColor: 'blue',
Expand Down Expand Up @@ -123,5 +124,6 @@ export const themeKobo = createTheme({
TagsInput: TagsInputThemeKobo,
ThemeIcon: ThemeIconThemeKobo,
NumberInput: NumberInputThemeKobo,
Radio: RadioThemeKobo,
},
})
Loading