types#ProteinSize TypeScript Examples
The following examples show how to use
types#ProteinSize.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: questionnaire.tsx From RareCamp with Apache License 2.0 | 6 votes |
function isGeneTherapyFeasible(answers: Questionnaire): boolean {
if (
answers.mutationType === MutationType.NOT_SURE ||
answers.proteinSize === ProteinSize.NOT_SURE
)
return true
return (
answers.mutationType === MutationType.LEADS_TO_LOSS &&
answers.proteinSize === ProteinSize.LESS_THAN_1100
)
}
Example #2
Source File: questionnaire.tsx From RareCamp with Apache License 2.0 | 6 votes |
ProteinFrom = () => {
return (
<>
<Form.Item
label="What is the size of the protein?"
name="proteinSize"
rules={[
{
required: true,
message: 'Please select one of the options',
},
]}
>
<Radio.Group>
<Radio value={ProteinSize.LESS_THAN_1100}>
{proteinSizeTypesMap[ProteinSize.LESS_THAN_1100]}
</Radio>
<Radio value={ProteinSize.MORE_THAN_1100}>
{proteinSizeTypesMap[ProteinSize.MORE_THAN_1100]}
</Radio>
<Radio value={ProteinSize.NOT_SURE}>
{proteinSizeTypesMap[ProteinSize.NOT_SURE]}
</Radio>
</Radio.Group>
</Form.Item>
</>
)
}
Example #3
Source File: questionnaire.tsx From RareCamp with Apache License 2.0 | 4 votes |
export default function questionnaire() {
const [current, setCurrent] = React.useState(0)
const [formValues, setFormValues] = React.useState({})
const [feasibility, setFeasibility] = React.useState({
isFeasible: false,
assessmentFinished: false,
answers: {},
})
const [content, setContent] = React.useState({
imgURL: '/eligibility_2.png',
description:
"Lorem ipsum, or lipsum as it is sometimes known, is dummy text used in laying out print, graphic or web designs. The passage is attributed to an unknown typesetter in the 15th century who is thought to have scrambled parts of Cicero's De",
})
React.useEffect(() => {
if (current === 0)
setContent({
imgURL: '/eligibility_2.png',
description:
"Lorem ipsum, or lipsum as it is sometimes known, is dummy text used in laying out print, graphic or web designs. The passage is attributed to an unknown typesetter in the 15th century who is thought to have scrambled parts of Cicero's De",
})
else if (current === 1)
setContent({
imgURL: '/eligibility_4.png',
description:
"Lorem ipsum, or lipsum as it is sometimes known, is dummy text used in laying out print, graphic or web designs. The passage is attributed to an unknown typesetter in the 15th century who is thought to have scrambled parts of Cicero's De",
})
else
setContent({
imgURL: '/eligibility_3.png',
description:
"Lorem ipsum, or lipsum as it is sometimes known, is dummy text used in laying out print, graphic or web designs. The passage is attributed to an unknown typesetter in the 15th century who is thought to have scrambled parts of Cicero's De",
})
}, [current])
const [form] = Form.useForm()
useEffect(() => {
setFormValues({ ...formValues, ...form.getFieldsValue() })
}, [form])
async function handleFormSubmit(values: Questionnaire) {
const isFeasible = isGeneTherapyFeasible(values)
setFeasibility({
isFeasible,
assessmentFinished: true,
answers: values,
})
}
const nextStep = () =>
form.validateFields().then(() => setCurrent(current + 1))
const title = 'Determine eligibility for AAV-based gene therapy'
const subTitle =
'Complete this short questionnaire to help our team determine your eligibility.'
return (
<AppLayout title="" selectedKey="programs">
<SubHeader title={<h3>{title}</h3>} subTitle={subTitle} />
<QuestionnaireContainer>
<div className="questionnaire-form">
{feasibility.assessmentFinished ? (
<QuestionnaireResult
isFeasible={feasibility.isFeasible}
answers={feasibility.answers as Questionnaire}
/>
) : (
<>
<Steps current={current}>
{steps.map((item, index) => (
<Step
className={index === 0 ? 'first-step' : ''}
key={item.title}
title={item.title}
/>
))}
</Steps>
<OFForm
onFinish={handleFormSubmit}
initialValues={{
proteinSize: ProteinSize.LESS_THAN_1100,
mutationType: MutationType.LEADS_TO_LOSS,
}}
layout="vertical"
form={form}
>
<div className="steps-content">
{steps.map((item, index) => (
<div
key={item.title}
style={{
display: index === current ? 'block' : 'none',
}}
>
{item.content}
</div>
))}
</div>
<div className="steps-action">
{current > 0 && (
<Button
style={{ margin: '0 8px' }}
onClick={() => setCurrent(current - 1)}
>
Back
</Button>
)}
{current < steps.length - 1 && (
<Button type="primary" onClick={nextStep}>
Next
</Button>
)}
{current === steps.length - 1 && (
<Button type="primary" htmlType="submit">
Check Eligibility
</Button>
)}
</div>
</OFForm>
</>
)}
</div>
<QuestionnaireIllustration
feasibility={feasibility}
className="questionnaire-illustration"
imgURL={content.imgURL}
description={content.description}
/>
</QuestionnaireContainer>
</AppLayout>
)
}